class not found exception com.mysql.jdbc.driver jar
I am working on a java front-end with a mysql database back-end.
It work's well in Eclipse, however, when I export it to a jar file I get the following 'class not found exception com.mysql.jdbc.driver jar' error via command prompt (see screenshot)
Maybe it's my main class? I know it has something to do with the build path but everything looks ok to me?
Code:
public static void main(String[] args) {
try {
Class.forName(JDBC_DRIVER);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
new DatabaseView();
}
Re: class not found exception com.mysql.jdbc.driver jar
Have you included the mysql driver jar on the classpath when starting the app (or better still have you added a class-path line in your manifest file that includes the mysql driver jar).
Re: class not found exception com.mysql.jdbc.driver jar
Hi,
The mysql driver is on the build path (as far as I can tell). I added it by right-clicking on the project in Eclipse/build path/configure and under Libraries I can see the mysql driver which I have under my lib folder. My program runs fine in Eclipse, i.e. my JFrame boots up etc and I can connect to the the mysql database.
Re: class not found exception com.mysql.jdbc.driver jar
Thanks - hadn't noticed that 'forward slash'.
Still can't create my jar file. 2 more screenshots 1)my layout in Eclipse and 2) the latest output from command
Re: class not found exception com.mysql.jdbc.driver jar
Apologies, I meant run jar not create.
Anyway, thanks for the lead - I put the jar in the folder relative to the lib directory and it is now running :-)
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.