RSS

Tag Archives: compile

Compile and Run Java Class With External Jar Using Console

Preparation

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.

Compile

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

Run

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: