Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java -cp "lib/*" versus java -cp "lib/*.jar"

If the lib/ directory contains only .jar files, what's the difference between

java -cp "lib/*" ...

and

java -cp "lib/*.jar" ...

If I use the latter I ran into errors regarding main class and I don't understand why. lib/* also contains lib/., but is this the crucial difference?

like image 632
Alexandru Avatar asked Jul 10 '26 16:07

Alexandru


1 Answers

According to the documentation of java only a basename of * is supported and it only ever matches .jar files.

Nothing in the documentation suggests that "*.jar" is supported or that the directory itself is added to the classpath.

like image 87
Joachim Sauer Avatar answered Jul 13 '26 20:07

Joachim Sauer