I have written a Java code which imports an external jar file. How can I compile and run it on the command-line?
Thanks in advance!
Compiling from the command-line:
javac -cp path_to_jar1.jar:path_to_jar2.jar Example.java
Running:
java -cp .:path_to_jar1.jar:path_to_jar2.jar Example
For Windows, use ;
as a path-separator (instead of :
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With