Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add multiple .jar files in the javac/java class path - for Debian Linux

Tags:

java

linux

debian

How to add multiple .jar files in the javac/java class path - for Debian Linux.

Iam using,

javac -cp a.jar folder1\folder2\b.jar Test.java

But, it is giving Invalid flag error. Can anybody help me how to compile and run it ?

like image 546
alessandro Avatar asked Apr 07 '12 17:04

alessandro


People also ask

How do I include all JARs in a folder classpath?

In general, to include all of the JARs in a given directory, you can use the wildcard * (not *. jar ). The wildcard only matches JARs, not class files; to get all classes in a directory, just end the classpath entry at the directory name.

How do I find the classpath of a jar file?

To check our CLASSPATH on Windows we can open a command prompt and type echo %CLASSPATH%. To check it on a Mac you need to open a terminal and type echo $CLASSPATH.


2 Answers

Separate the class path entries by : colons, not spaces.

like image 136
Louis Wasserman Avatar answered Oct 15 '22 18:10

Louis Wasserman


Also you should use '/' instead of '\' as directory separator.

like image 43
Filipp Avatar answered Oct 15 '22 18:10

Filipp