This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Java in General and the fly likes Problem loading MySQL driver class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem loading MySQL driver class" Watch "Problem loading MySQL driver class" New topic
Author

Problem loading MySQL driver class

M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 388
I am getting this error when I run my app. I set the MySQL jar file in my classpath in Windows and on the command line using -cp. But I still get this error when it hits Class.forName("com.mysql.jdbc.Driver").newInstance()...

C:\temp1>java -cp .;c:\mysql\mysql-connector-java-3.0.14-production-bin.jar -jar EasyCheckup.jar "c:\easycheck.csv"

Gen Exception : java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Originally posted by M Burke:
C:\temp1>java -cp .;c:\mysql\mysql-connector-java-3.0.14-production-bin.jar -jar EasyCheckup.jar "c:\easycheck.csv"

Gen Exception : java.lang.ClassNotFoundException: com.mysql.jdbc.Driver[/QB]

Try rename the driver "mysql-connector-java-3.0.14-production-bin.jar" to "mysql.jar" to see if it's due to typo error. Make sure you update the ClASSPATH. Check if this
thread will help.
M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 388
Hi Joyce,
The name is OK and its set in the classpath properly. I cut and pasted the name, I didn't type all that out.

I made a version not using a jar, just the .class files sitting in a directory, and it works fine. But the .jar version continues to throw up.

C:\temp1>java -cp .;c:\mysql\mysql-connector-java-3.0.14-production-bin.jar EasyCheckupBean.EasyCheckup
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem loading MySQL driver class