Forums Register Login
class not found exception
hi...while i am trying to run my java code...im gettin this error...is my jar file not found....
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver not found in [file:/usr/share/java/libgcj-3.4.3.jar, file:./, core:/]
at java.net.URLClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
at gnu.gcj.runtime.VMClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
at java.lang.ClassLoader.loadClass(java.lang.String, boolean) (/usr/lib/libgcj.so.5.0.0)
at _Jv_FindClass(_Jv_Utf8Const, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0)
at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0)
at java.lang.Class.forName(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
at Conn.main(java.lang.String[]) (Unknown Source)
thanks in advance
Welcome to JavaRanch.

How did you add the jar file to your classpath?
Actually i am having java in /usr/share.but inside it i didnt found jre,jdk.inside the java folder i found the following jar files.
pg74.215.jdbc3.jar.I have put the mysql-connector-java-3.0.10-stable-bin.jar along these jar files.
Those files are most likely not added to your classpath automatically (they might be, depending on which directory they're in - I can't tell from your post). You need to do that explicitly.

As an aside, if you're using Postgres (which is what the other jar files in that directory are for), you should only use a single one of those files. See this page for which to use.
sorry,I cant get you.
If you want to use external library (like the Mysql driver) that comes in a jar file, you need to put it into the so-called classpath for the JVM to find it. On the command line, this is generally done by using a command like:

Note that I added the "." as a second entry to the classpath, so that any class hierarchy in the current directory is also found.

This thread has been viewed 1315 times.

All times above are in ranch (not your local) time.
The current ranch time is
Dec 10, 2018 11:35:58.