File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes runtime error in jdbc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "runtime error in jdbc" Watch "runtime error in jdbc" New topic

runtime error in jdbc

preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
when i am trying to compile my program,it is compiling well.But when running It is showing the following error:

root@localhost agi-bin]# java -classpath .:/usr/java/jdk1.6.0_04/lib/mysql-connector-java-3.0.17-ga/mysql-connector-java-3.0.17-ga/mysql-connector-java-3.0.17-ga-bin.jar Connect
Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class: com.mysql.jdbc.MysqlIO
at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/
at java.lang.Class.initializeClass() (/usr/lib/
at com.mysql.jdbc.Connection.createNewIO(boolean) (Unknown Source)
at com.mysql.jdbc.Connection.Connection(java.lang.String, int, java.util.Properties, java.lang.String, java.lang.String, com.mysql.jdbc.NonRegisteringDriver) (Unknown Source)
at com.mysql.jdbc.NonRegisteringDriver.connect(java.lang.String, java.util.Properties) (Unknown Source)
at java.sql.DriverManager.getConnection(java.lang.String, java.util.Properties) (/usr/lib/
at java.sql.DriverManager.getConnection(java.lang.String, java.lang.String, java.lang.String) (/usr/lib/
at Connect.main(java.lang.String[]) (Unknown Source)
Caused by: java.lang.ClassNotFoundException: not found in [file:./, file:/usr/java/jdk1.6.0_04/lib/mysql-connector-java-3.0.17-ga/mysql-connector-java-3.0.17-ga/mysql-connector-java-3.0.17-ga-bin.jar, file:/usr/share/java/libgcj-3.4.3.jar, file:./, core:/]
at (/usr/lib/
at gnu.gcj.runtime.VMClassLoader.findClass(java.lang.String) (/usr/lib/
at java.lang.ClassLoader.loadClass(java.lang.String, boolean) (/usr/lib/
at _Jv_FindClass(_Jv_Utf8Const, java.lang.ClassLoader) (/usr/lib/
at _Jv_PrepareCompiledClass(java.lang.Class) (/usr/lib/
at _Jv_WaitForState(java.lang.Class, int) (/usr/lib/
at java.lang.VMClassLoader.linkClass0(java.lang.Class) (/usr/lib/
at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/
...7 more

I am unable to find what is the java file is in /var/lib/asterisk/agibin.
my sqljar file is in the path:/usr/java/jdk1.6.0_04/lib/mysql-connector-java-3.0.17-ga/mysql-connector-java-3.0.17-ga/mysql-connector-java-3.0.17-ga-bin.jar
mnadeem chishti

Joined: Aug 07, 2006
Posts: 11
Please can you past code snipt here you are using to ....
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32844

You might want to try quotes around the classpath:
java -classpath ".:/usr/java/jdk1.6.0_04/lib/mysql-connector-java-3.0.17-ga/mysql-connector-java-3.0.17-ga/mysql-connector-java-3.0.17-ga-bin.jar"

Also can you make sure the path is correct by running the command:
"ls /usr/java/jdk1.6.0_04/lib/mysql-connector-java-3.0.17-ga/mysql-connector-java-3.0.17-ga/mysql-connector-java-3.0.17-ga-bin.jar"

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
Thank problem is path was incorrect.Now it is running well.
I agree. Here's the link:
subject: runtime error in jdbc
It's not a secret anymore!