Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training

Solving java.lang.ClassNotFoundException: com.mysql.jdbc.Driver exception

This exception java.lang.ClassNotFoundException: com.mysql.jdbc.Driver occurs when there is not JDBC driver for MySQL in project.


JDBC Video Tutorial: Create, Read, Update and Delete (CRUD) Operation examples JDBC Video tutorial - How to read Data from MySQL Database? JDBC Video tutorial - How to delete Data in a MySQL Database? Solving java.lang.ClassNotFoundException: com.mysql.jdbc.Driver exception JDBC Video tutorial - How to update Data in a MySQL Database? JDBC Video Tutorial- How to insert data into MySQL database table? JDBC Video Tutorial: How to download JDBC Driver for MySQL? JDBC Tutorial - Writing first JDBC example and running in Eclipse Java Cross Join MySQL Database Connectivity Example In Java Change Column Name in MySQL Java Mysql Connection Example JDBC ODBC Connection In Java ResultSet In Java Prepared Statement Example JdbcRowSet interface Java JdbcRowSet Example First Step towards JDBC! JDBC Training, Learn JDBC yourself Jdbc Get Column Names JDBC Example with MySQL JDBC Prepared Statement Update JDBC Prepared Statement Insert JDBC Prepared Statement Example JDBC Prepared statement Close JDBC Prepared Statement Addbatch JDBC Nested Resultset JDBC-Odbc Connection JDBC-Odbc Connectivity JDBC Insert Preparedstatement JDBC Insert Null JDBC Get Metadata JDBC Insert Record Jdbc Insert Statement JDBC Meta Data Get tables Jdbc Mysql Connection String Jdbc Mysql Connection Url JDBC Next Jdbc Get Connection JDBC Get Int JDBC Exception JDBC Get Row Count JDBC Functions JDBC Fetch JDBC Execute Update Example JDBC Execute Statement JDBC Execute Query JDBC Drive For Mysql JDBC Connectivity Code In Java JDBC connection timeout

In this video tutorial I will show you an Eclipse project which is throwing the java.lang.ClassNotFoundException: com.mysql.jdbc.Driver exception while running the example program.

I will also explain you how you can solve the exception, which is occurring at run-time and preventing your application to be executed.

In our example program following exception is thrown at the time of running of the application:


java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
            at$ Source)
            at$ Source)
            at Method)
            at Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Unknown Source)
            at net.roseindia.jdbc.UpdateDataExample.main(

As the error indicates there is a mi Visit the website and you will find the link for downloading the JDBC Driver. ssing class and the JVM is not able to find the class com.mysql.jdbc.Driver. Our JDBC program is connecting the MySQL database and then updating the data, but due to unavailability of the driver it is throwing exception.

To solve this you solve the error you have to download the JDBC driver of MySQL and then install.

Here is the video tutorial that shows you how resolve the java.lang.ClassNotFoundException: com.mysql.jdbc.Driver exception.

Visit the website and you will find the link for downloading the JDBC Driver. From here you can download the JDBC driver for MySQL. After downloading the driver unzip it and then copy the mysql-connector-java-5.1.35-bin.jar file in your Eclipse project.

It is better to create a new directory lib in your project and then copy the mysql-connector-java-5.1.35-bin.jar file there.

Then include the jar file in the "Libraries" of the "Java Build Path" in Eclipse IDE.

Complete process is explained in the Video Tutorial and you should check the video for complete details.

Check the video tutorial: JDBC Video Tutorial: How to download JDBC Driver for MySQL?

Check 100s of JDBC Tutorials in our JDBC programming tutorials section.


Share on Google+Share on Google+

Solving java.lang.ClassNotFoundException: com.mysql.jdbc.Driver exception

Posted on: June 8, 2015 If you enjoyed this post then why not add us on Google+? Add us to your Circles



Discuss: Solving java.lang.ClassNotFoundException: com.mysql.jdbc.Driver exception  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image