[Java] Java Compiling & Execution in Shell

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.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • MySpace
  • Reddit
  • Technorati
  • Twitter

My favorite listmania


Warning: Invalid argument supplied for foreach() in /home/flvdatac/public_html/sub_neox.net/w/amazon_ad_helper/template.listmania2.php on line 94
  1. No comments yet.
(will not be published)
  1. No trackbacks yet.
Quick Coupons!
Abe's of Maine: Actually , if you buy a product more than $75, you can use FRIEND10 coupon code to get extra $10 off!