Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem loading MySQL driver class

 
M Burke
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic