As I was browsing the Mustang JVM reference documentation, I came accross by accident the paragraph about this new feature named “class path wildcards”.
It reminds me of this Java Evangelist woman at the Paris Sun Techdays making her best to sell the “great” new features of Java 6. 16 slides about annotation processors, sub-pixels, splash screen, tray icon and… classpath wildcard. The content was so poor that she spent 15 minutes on this feature, explaining how powerful it is. She was really doing a perfect evangelist job by delivering word for word the corporate and over-marketed speech, but without conviction. You know like these sales demonstrators at the supermarket flogging the latest super-fully-loaded grater because well they have to pay the rent… My heart was full of compassion for her.
So, as I was browsing the Mustang JVM reference documentation, I stoped and spent 2 minutes to read carefully the paragraph about classpath wildcard as a tribute to my Java Evangelist woman. To my surprise I realised that only the single ‘*’ is implemented. Nothing as powerfull as the Ant file pattern. No ‘**’ to include subdirectories recursively! I might have been too focused on the evangelist to miss that during the presentation.
Under the pressure of Seb, I wrote a quick test to exclude a documentation inaccuracy (see below), but no doubt only the single ‘*’ is implemented.
I really can’t understand why only half of the feature is implemented. And Mark Reinhold, the spec lead of the JavaSE6 (JSR270) did not say much more about this staged process, he simply put:
“There’s no equivalent to Ant’s /** construct, though that could be added later on.”
Come on Mark… why stopping in the middle for such a simple thing?
public class WildcardTest{
public static void main(String[] args){
System.out.println(System.getProperties().getProperty("java.version"));
System.out.println(System.getProperties().getProperty("java.class.path"));
}
}
The output could look like:
$ java -cp .:'.m2/repository/ant/ant/1.6.5/*':'.m2/repository/**' WildcardTest
1.6.0_02
.:.m2/repository/ant/ant/1.6.5/ant-1.6.5.jar:.m2/repository/**