This question already has an answer here:
- com.mysql.jdbc.Driver what to do? 2 answers
I've created little java application that connects to MySQL. I tested it on my local machine and it worked fine. I exported the Java project to Runnable jar file using Eclipse.
I copied the jar file on my server running Ubuntu 12.04 and ran it with the command
java -jar server.jar
and it threw the error:
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:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
I understand that this class could not be found on the server. Then - how can I install this driver?
I have everything in folder /tvplan/ there's a server.jar file that is exported as Runnable jar also there is a folder lib which holds mysql-connector-java.jar and libintl.jar (both I got using sudo apt-get install libmysql-java , but when I run java -cp "lib/mysql-connector-java.jar;server.jar" Server bt it throws me an error Error: Could not find or load main class Server
java -jar ...
command – Luiggi Mendoza Aug 12 at 17:19