This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JDBC and the fly likes Could not find com.mysql.jdbc.Driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Could not find com.mysql.jdbc.Driver " Watch "Could not find com.mysql.jdbc.Driver " New topic

Could not find com.mysql.jdbc.Driver

Amit Lohar

Joined: Aug 27, 2012
Posts: 6
i am usin fedora 14 (i386)..
problem while connecting jdbc with me it is--

[Amit@root Downloads]$ java MysqlConnect
MySQL Connect Example.
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(
at MysqlConnect.main(
[Amit@root Downloads]$ javap com.mysql.jdbc.Driver
ERROR:Could not find com.mysql.jdbc.Driver

help me out...i have set classpath..
tell me how to set it n how to check that i can check mine..please help me out..please...
Divya Chandel
Ranch Hand

Joined: Jun 09, 2011
Posts: 45

Try this-

Put Driver mysql-connector (jar) in classpath
And also in WEB-INF/lib/ folder.

Thank you

Amit Lohar

Joined: Aug 27, 2012
Posts: 6
please explain in brief..please i need this to work..please..
Divya Chandel
Ranch Hand

Joined: Jun 09, 2011
Posts: 45

Hi Amit,

Can you make a new folder name 'lib' inside WEBINF folder and copy the mysql driver inside that lib folder than try to run
hopefully it will work.
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 485

Copy the mysql-connector-java-5.1.21-bin.jar file under the same location of file, compile and type the following command to run the program:

You can see more details here.

PM Me If You Want to get Urgent Help on Java Programming
I agree. Here's the link:
subject: Could not find com.mysql.jdbc.Driver
Similar Threads
connection not possible, even after using the connector
Exception in thread "main" java.lang.NoClassDefFoundError: Voice1
Problem with loading driver
mysql connection problem
EAR precompilation - java.lang.NoClassDefFoundError: weblogic/utils/compiler/Tool