I took an example from the internet to connect with MySQL
private static final String USUARIO = "root";
private static final String SENHA = "123456";
private static final String URL = "jdbc:mysql://127.0.0.1:3306/aulas";
private static final String DRIVER = "com.mysql.jdbc.Driver";
public static Connection abrir() throws Exception
{
Class.forName(DRIVER);
Connection conn = DriverManager.getConnection(URL, USUARIO, SENHA);
System.out.println("Conectado");
return conn;
}
And this error happens
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader.findClass(Unknown 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 Default.Main.abrir(Main.java:52)
at Default.Main.<init>(Main.java:64)
at Default.Main.main(Main.java:36)
How can I fix this?
EDIT
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="mysql-connector-java-5.1.39.zip"/>
<classpathentry kind="output" path="bin"/>