This question already has an answer here:
I'm running Ubuntu and want to execute a Java file from terminal by including multiple jar files.
All my jars are included in tha jar folder.
I tried
javac -cp jar/A.jar: jar/B.jar: jar/C.jar: jar/D.jar MyFile.java
I get below error.
javac: invalid flag: jar/B.jar:
Usage: javac <options> <source files>
use -help for a list of possible option
Can anyone guide how to use multiple jars in classpath ?
Remove the spaces from the classpath and add the current path
Since Java 6 you can use classpath wilcards
ClassPath set through command prompt will work only for current cmd window. Once you close it and open a new cmd window it will not work. Rather than setting classpath from command prompt, keep related paths to system properties:
For windows:
go to My Computer--> Properties--> Advance System Settings--> Environment Variables--> CLASSPATH--> put your path like this-->
path1;path2;path3;.
Don't forget to keep . (DOT) at the end.