简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM