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 have encountered errors regarding the main class, and I do not understand why. lib/*also contains lib/., but is this a crucial difference?

+3
source share
1 answer

According to the documentationjava , only the base name is supported *, and it always only matches .jar files.

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

+4
source

Source: https://habr.com/ru/post/1733218/


All Articles