0

Possible Duplicate:
Setting multiple jars in java classpath

I am wondering if I can use a wild card to specify jars in the java -cp *.jar command ?

Community
  • 1
  • 1
Adam Lee
  • 24,710
  • 51
  • 156
  • 236

2 Answers2

5

Yes, as of Java 6. I don't think this ability existed in previous versions, so for older programs you'll often see shell scripts manually building up the classpath based on the contents of a directory.

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. For example, the class path entry foo/* specifies all JAR files in the directory named foo. A classpath entry consisting simply of * expands to a list of all the jar files in the current directory.

http://docs.oracle.com/javase/6/docs/technotes/tools/windows/classpath.html

Alex
  • 13,811
  • 1
  • 37
  • 50
0

It'll basically depend on the context, i.e. if the interpreter will explode or not the *.jar expression.

Alexis Pigeon
  • 7,423
  • 11
  • 39
  • 44