JDK-8029388 : java.exe consumes argument intended for launched java class
  • Type: Bug
  • Component: tools
  • Sub-Component: launcher
  • Affected Version: 7u45
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows
  • Submitted: 2013-11-29
  • Updated: 2014-11-11
  • Resolved: 2013-12-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u20Fixed 9 b01Fixed
Description
FULL PRODUCT VERSION :
C:\temp
est>java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) Client VM (build 24.45-b08, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]

A DESCRIPTION OF THE PROBLEM :
Take the following trivial class that prints out its arguments:

public class A {
        public static void main(String[] args) {
                System.err.println("args >");
                for(int i = 0; i < args.length; i++) {
                        System.err.println(args[i]);
                }
                System.err.println("args <");
        }
}

Run the following command on Windows under 32 bit Java 6:

C:\temp>java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) Client VM (build 20.45-b01, mixed mode, sharing)

C:\temp>java A -d64
args >
-d64
args <

The -d64 parameters is passed correctly to the Java program.

Under Java 7, 32 bit:

C:\temp
est>java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) Client VM (build 24.45-b08, mixed mode, sharing)

C:\temp
est>java A -d64
Error: This Java instance does not support a 64-bit JVM.
Please install the desired version.

My application expects to receive the -d64 argument, but udner Java 7 it is not being delivered

Note:

a) It occurs with 'java -jar A.java -d64' also
b) the java usage message is:

C:\temp
est>java
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)

Which states that anything after the classname (or after '... -jar jarname') should be passed as an argument




REGRESSION.  Last worked in version 6u45

ADDITIONAL REGRESSION INFORMATION:
C:\temp>java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) Client VM (build 20.45-b01, mixed mode, sharing)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See description

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
See description
ACTUAL -
See description

REPRODUCIBILITY :
This bug can be reproduced always.
Comments
Release team: Approved for deferral.
06-12-2013

Fix attached
04-12-2013

sqe-ok: after a little testing, it appears -d64 is the only option that is gobbled up by java.exe. It also appears it was introduces in b09 of jdk 1.7.0 and has been there since.
04-12-2013

ILW: LLM Justification: this bug is a corner case bug introduced back in jdk7-b09, this is only on windows and will affect only if -d32/-d64 is specified as an application argument.
03-12-2013

This is a regression caused by fix for JDK-6277269 and has present since jdk7-b09.
03-12-2013