Running a Java Class from a Jar thru a command line
command-line, jar, java
Solution
Windows
java -classpath .;path/to/yourlib.jar your.package.path.ClassWithMain
Linux (I guess)
java -classpath .:path/to/yourlib.jar your.package.path.ClassWithMain
Or if you don't use packages just do (for Windows)
java -classpath .;path/to/yourlib.jar ClassWithMain
Problem
I have a jar file with several classes which have static main methods. Can I execute them inside the jar from the command line? If not, can I execute them one by one?