Reputation: 29669
Im using JDK 1.6.0.25. I'm trying to include a classpath like so:
-cp .;Server.jar;Util.jar;../jars/**/*;./lib/*
Whatever I do, this doesn't work and I end up having to explicity refer to the files within those directories. Any idea how to debug this or does anyone know what I am doing wrong?
Upvotes: 0
Views: 196
Reputation: 10115
See Settings the classpath (Section "Understanding class path wildcards")
You cannot use the Ant or Bash style wildcards, you can only use it in the 'standard' way.
Upvotes: 3
Reputation: 76719
From the Java application launcher documentation:
Class path entries can contain the basename wildcard character *, which is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR.
Note that there is no mention of the sequence **
, which is not going to be interpreted in any sensible manner by the java executable. You cannot search recursively within sub-directories as well:
Subdirectories are not searched recursively. For example, foo/* looks for JAR files only in foo, not in foo/bar, foo/baz, etc.
In other words, all child directories of the jars
directory in the classpath entry ../jars/**/*
will have to be explicitly specified if you intend to use wildcards directly from the command-line.
Upvotes: 2