i got a ClassNotFoundException with this code:
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
MySQL.connect();
I imported the mysql-connector (http://dev.mysql.com/downloads/connector/j/5.0.html) and added it in a special folder (I named it External) and added it to the build-path. When I launch it in Eclipse it works fine for me but if I export it as jar and launch it by java -jar it does not work to me and I get the ClassNotFoundException... Hope someone could help me :) Mabye it has to do something with the classpath but how do I edit it because -cp External/mysql-connector.jar does not work..