I have the following code:
import java.io.IOException;
public class DbTest {
public static void main(String[] args) {
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
}
I downloaded the Platform Independent .zip version of the MySQL Connector from the following location:
http://dev.mysql.com/downloads/connector/j/
Then, after unzipping the file downloaded, I placed the resulting folder at the following location:
/java/mysql-connector-java-5.1.36
I am compiling my code from within the directory where it resides with the following command:
javac DbTest.java -cp /java/mysql-connector-java-5.1.36/mysql-connector-java-5.1.36-bin.jar
Finally, I am running my code with the following command:
java DbTest
The full stack trace from the event is as follows:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:191)
at DbTest.main(DbTest.java:6)
Thanks in advance for any help you can offer!