-
Bug
-
Resolution: Fixed
-
P2
-
7, 7u6
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8018906 | 7u45 | Kumar Srinivasan | P2 | Closed | Fixed | b01 |
JDK-2221783 | 7u40 | Kumar Srinivasan | P3 | Closed | Fixed | b08 |
JDK-8000304 | 7u10 | Kumar Srinivasan | P2 | Closed | Fixed | b12 |
java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b05)
Java HotSpot(TM) Client VM (build 22.1-b02, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Wildcard expansion doesn't work correctly for -classpath (-cp) parameter when only one entry is specified.
REGRESSION. Last worked in version 6u29
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Script (batch file) for running the test:
mkdir lib
javac test/*.java
jar cvf lib/a.jar test/A.class
jar cvf lib/b.jar test/B.class
java -cp "lib/*" test.B
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Following message should be on the output:
main() in class B executed
ACTUAL -
Following message appears on the output:
Error: Could not find or load main class lib.b.jar
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Java launcher debug info when it doesn't work:
----_JAVA_LAUNCHER_DEBUG----
Launcher state:
debug:on
javargs:off
program name:java
launcher name:java
javaw:off
fullversion:1.7.0_03-b05
dotversion:1.7
ergo_policy:DEFAULT_ERGONOMICS_POLICY
Command line args:
argv[0] = java
argv[1] = -cp
argv[2] = lib/a.jar
argv[3] = lib/b.jar
argv[4] = test.B
JRE path is c:\Program Files\Java\jre7
jvm.cfg[0] = ->-client<-
jvm.cfg[1] = ->-server<-
jvm.cfg[2] = ->-hotspot<-
name: -hotspot vmType: VM_ALIASED_TO alias: -client
jvm.cfg[3] = ->-classic<-
jvm.cfg[4] = ->-native<-
jvm.cfg[5] = ->-green<-
8371 micro seconds to parse jvm.cfg
Default VM: client
JVM path is c:\Program Files\Java\jre7\bin\client\jvm.dll
JRE path is c:\Program Files\Java\jre7
CRT path is c:\Program Files\Java\jre7\bin\msvcr100.dll
8795 micro seconds to LoadJavaVM
JavaVM args:
version 0x00010002, ignoreUnrecognized is JNI_FALSE, nOptions is 5
option[ 0] = '-Dsun.java.launcher.diag=true'
option[ 1] = '-Djava.class.path=.'
option[ 2] = '-Djava.class.path=lib/a.jar'
option[ 3] = '-Dsun.java.command=lib/b.jar test.B'
option[ 4] = '-Dsun.java.launcher=SUN_STANDARD'
59450 micro seconds to InitializeJVM
Main class is 'lib/b.jar'
App's argc is 1
argv[ 0] = 'test.B'
Error: Could not find or load main class lib.b.jar
java.lang.ClassNotFoundException: lib.b.jar
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Java launcher debug info when it works:
----_JAVA_LAUNCHER_DEBUG----
Launcher state:
debug:on
javargs:off
program name:java
launcher name:java
javaw:off
fullversion:1.7.0_03-b05
dotversion:1.7
ergo_policy:DEFAULT_ERGONOMICS_POLICY
Command line args:
argv[0] = java
argv[1] = -cp
argv[2] = lib/*;
argv[3] = test.B
JRE path is c:\Program Files\Java\jre7
jvm.cfg[0] = ->-client<-
jvm.cfg[1] = ->-server<-
jvm.cfg[2] = ->-hotspot<-
name: -hotspot vmType: VM_ALIASED_TO alias: -client
jvm.cfg[3] = ->-classic<-
jvm.cfg[4] = ->-native<-
jvm.cfg[5] = ->-green<-
322 micro seconds to parse jvm.cfg
Default VM: client
JVM path is c:\Program Files\Java\jre7\bin\client\jvm.dll
JRE path is c:\Program Files\Java\jre7
CRT path is c:\Program Files\Java\jre7\bin\msvcr100.dll
5365 micro seconds to LoadJavaVM
Expanded wildcards:
before: "lib/*;"
after : "lib/a.jar;lib/b.jar;"
JavaVM args:
version 0x00010002, ignoreUnrecognized is JNI_FALSE, nOptions is 5
option[ 0] = '-Dsun.java.launcher.diag=true'
option[ 1] = '-Djava.class.path=.'
option[ 2] = '-Djava.class.path=lib/a.jar;lib/b.jar;'
option[ 3] = '-Dsun.java.command=test.B'
option[ 4] = '-Dsun.java.launcher=SUN_STANDARD'
51245 micro seconds to InitializeJVM
Main class is 'test.B'
App's argc is 0
13358 micro seconds to load main class
----_JAVA_LAUNCHER_DEBUG----
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
File test/A.java:
---
package test;
class A {
}
---
File test/B.java:
---
package test;
class B {
public static void main(String[] args) {
System.out.println("main() in class B executed");
}
}
---
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Command line for executing the code must be modified e.g. like following:
java -cp "lib/*;" test.B
Please note that instead of "*" is there "*;". Then execution works as expected.
- backported by
-
JDK-8000304 Wildcard expansion for single entry classpath
- Closed
-
JDK-8018906 Wildcard expansion for single entry classpath
- Closed
-
JDK-2221783 Wildcard expansion for single entry classpath
- Closed
- duplicates
-
JDK-7167744 Impossible to escape metacharacters on command line e.g. "*"
- Closed
-
JDK-7161292 strange java 7 behavior on windows ( star arg "*")
- Closed
-
JDK-7020954 Different Behavior in java.exe among windows editions and c libraries when "*" is set as an argument
- Closed
-
JDK-7073915 Wildcards in classpath does not work on command prompt.
- Closed
-
JDK-7146578 Singular classpaths using wildcard result in loading errors
- Closed
-
JDK-8028359 asterisk in classpath does not work as expected on windows
- Closed
- relates to
-
JDK-8031408 [docs] Release note JDK-8030961
- Resolved
-
JDK-7188114 (launcher) need an alternate command line parser for Windows
- Closed
-
JDK-4342394 Compilation of Multiple java files filed
- Resolved
-
JDK-8013821 Wildcard bugfix consequence
- Resolved
-
JDK-6328875 Multiple command line wildcard expansion confuses Windows users
- Closed
-
JDK-8030961 [launcher] java tools requires the whole argument containing spaces to be quoted
- Closed