I'd like to reference several JARs at once in my CLASSPATH. Can I use an asterisk for this?
Asked
Active
Viewed 951 times
0
-
Yes you can use. Can you give some more detail? – Rohit Jain Aug 28 '13 at 13:46
1 Answers
5
Yes.
java -cp "lib/*" MainClass
Note that quotes are mandatory, see this question for additional details.

Community
- 1
- 1

OlivierBlanvillain
- 7,701
- 4
- 32
- 51
-
-
3Be aware that this isn't quite "globbing" in the Unix sense; the JVM specifically looks for the character `*` (which you need to protect from the shell, e.g. by using the double-quotes above) and grabs all the jars in the directory when it sees it. – chrylis -cautiouslyoptimistic- Aug 28 '13 at 13:59
-
@chrylis the comment should really be part of the answer. Mind adding it? – Jacek Laskowski Jan 24 '14 at 11:04