java.lang.ClassNotFoundException: com.mysql.jdbc.Driver java error

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver java error

After executing below code i get java.lang.ClassNotFoundException: com.mysql.jdbc.Driver error.How do i go about solving this mysql server connection error with java.

Code

This error is brought about by the lack of MySQL-connector libraries in your class path.First, download MySQL-connector and then go ahead and add it to your project.

If you are using NetBeans, click your project and go to Libraries.

java-rent-management-system

Click Add Jar file and below window will open.adding-jdbc-driver

Set it as an absolute path.Then click open.

The mysql-connector file should appear as shown below and the error should disappear away.

java connecting to mysql server

About the Author: Eric K

Kenyan Developer and Blogger with Interests in Java,Javascript,Node.js, Wordpress, Android, PHP and Making Money Online. Solving world problems through programming is my passion. Hire me: Email : kawi3462@gmail.com