Press enter to see results or esc to cancel.


java.lang.ClassNotFoundException: com.mysql.jdbc:Driver [Solved]

  1. The Exception in Java Project is shown below.
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at Simple.MyProg.main(MyProg.java:15)
    
  2. Solution,
    Download the Mysql Jar from below link.
    https://chillyfacts.com/mysql-connector-jar-download/
  3. Add the jar to Classpath. Check the below link to add the Jar in Classpath in Eclipse
    https://chillyfacts.com/how-to-add-jar-file-in-eclipse-java-project/
  4. See an Example Projects
    Java program to connect to mysql database
    https://chillyfacts.com/java-program-to-connect-to-mysql-database/
    How to connect to remote MySql database from NetBeans
    https://chillyfacts.com/how-to-connect-to-remote-mysql-database-from-netbeans/

Comments

Leave a Comment