I used IDEA14 to make a DBMS application in java with Swing as the GUI. Now that I try to run it as a Jar file, I'm having class not found exception for the Mysql JDBC Connector. I'm completely stuck and have no clue on how to resolve the issue...
1 Answers
You are trying to put mysql.jar dependency in the same jar and to reference it with manifest's Class-Path, and this not possible with the default java class loader.
See for details official java documentation at https://docs.oracle.com/javase/tutorial/deployment/jar/downman.html
One way of fixing this is to move mysql.jar out of the SMSReminder.jar artifact, to be on the same level as SMSRemider.jar. Change the Class-Path entry to become Class-Path: mysql.jar (note there is no full path here like c:/ideaprojects/..). When building the artifact, IDEA will place both jars in one and the same folder. Then running the java -jar SMSReminder.jar should work.
Another way is to use custom or some opensource class loader, as described here: Classpath including JAR within a JAR

- 1
- 1

- 3,783
- 1
- 12
- 16