Tag Archives: linux

Compile and Run Java Class With External Jar Using Console


In this example I use mysql-connector-java-5.1.6.jar for external library. I already set my Java classpath on windows environment variables. My java main class is QueryManager.class and need one argument placed under controller package. Important to know, you must place your main class under a package, cause it’s important for JVM to know where to start search your class.


javac -classpath mysql-connector-java-5.1.6.jar; controller/*.java
javac -classpath mysql-connector-java-5.1.6.jar: controller/*.java


java -classpath mysql-connector-java-5.1.6.jar; controller.QueryManager "TRUE"
java -classpath mysql-connector-java-5.1.6.jar: controller.QueryManager "TRUE"
Leave a comment

Posted by on April 13, 2013 in Education


Tags: , , , , , ,

%d bloggers like this: