I observe a strange behavior of wildcard expansion behavior for Java7 on Windows.
For centuries there was a clean difference between "*" versus *.
Seems this it not longer true for Java7 (at least on Windows7).
I noticed the problem when using a wildcard classpath.
In despite of quoting the wildcard-classpath it gets expanded.
Thus it seems not possible any more to pass a wildcard to the java application.
So using java -cp "somewhere/*"
will fail (as does "somewhere\*"
).
A workaround seems to be: java -cp "somewhere/*;"
which inhibits the expansion.
To verify the behavior I wrote a small Echo.java class.
I found that using java 1.6.0 quoted "*" and plain * works like expected, whereas on Java7 I always got the expanded wildcard. Until now this was observed on Windows7, don't know what happens on XP.
The problem arises, since wildcards on Windows are never ever expanded by dark age CMD.EXE (like any shell does on UNIX). Instead each executable has to perform this explicitly using setargv.obj.
I found two related issues which seem to describe a similar problem:
- Multiple command line wildcard expansion confuses Windows users
- setargv.obj wildcard handling broken
Is this observed by someone else?
Or are there some obscure Windows or batch-file settings to control this?
Dieter.
_JAVA_LAUNCHER_DEBUG
launcher will show additional info about expanding classpath. Maybe it will help to understand what is going on inside java.exe. – Mersenne_JAVA_LAUNCHER_DEBUG
also shows that"*"
decays: java -cp . Echo "*" Command line args: argv[0] = C:\Program Files\Java\jdk1.7\bin\java.exe argv[1] = -cp argv[2] = . argv[3] = Echo argv[4] = Echo.class argv[5] = Echo.java – Ditz