ClassNotFoundException in MySQL Connector/J
Posted
by
Ephraim
on Stack Overflow
See other posts from Stack Overflow
or by Ephraim
Published on 2012-05-31T16:06:16Z
Indexed on
2012/05/31
16:40 UTC
Read the original article
Hit count: 434
This has been asked before but I cannot find the answer I need.
1) Using Class.forName("com.mysql.java.Driver")
in the eclipse IDE all works well. I load the correct jar (mysql-connector-java-5.1.20-bin.jar), no exception.
When I create a jar for my app a1.jar and double click the jar, I get the ClassnotFoundException
.
I created a .bat file in Windows XP with
java -classpath c:\temp\mysql-connector-java-5.1.20-bin.jar -jar c:\temp\a1.jar
the app statrs with the same exception.
Furthermore using System.getProperty ("java.class.path")
shows c:\temp\a1.jar
whilst in the IDE I can see several directories
© Stack Overflow or respective owner