August 23, 2006

[Java] Java Compiling & Execution in Shell

Filed under: Programming — HanaDaddy @ 10:33 pm

I just created this DB transfering class from Oracle to Mysql and tried to run it under linux, but had hard time to compile & run it.

But I successfully did it. And the code works fine too.


javac -classpath /var/www/java_libs/mysql-connector-java-3.1.7-bin.jar:/var/www/java_libs/v9_ojdbc14.jar:/var/www/import importdb/Import.java

java -classpath /var/www/java_libs/mysql-connector-java-3.1.7-bin.jar:/var/www/java_libs/v9_ojdbc14.jar:/var/www/import importdb/Import

The main class is Import and it is a part of package ImportDB.

/var/www/java_libs/mysql-connector-java-3.1.7-bin.jar : MySQL lib downloaded from MySQL website

/var/www/java_libs/v9_ojdbc14.jar : Oracle Lib downloaded from Oracle website

Note that the /var/www/import in the classpath. This is where importdb folder is located. It is necessary. Without it, you will get Exception in thread “main” java.lang.NoClassDefFoundError: importdb/Import.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

 

50 queries. 0.371 seconds. Powered by WordPress