vendredi 4 décembre 2015

ClassNotFoundException: org.sqlite.JDBC in a JAR

The application runs without problems in Eclipse. It has a SQLite database which is referenced with relative path as follows:

connection = DriverManager.getConnection("jdbc:sqlite"+absPath+File.pathSeparator+"PatientRegistry.sqlite");

Where absPath is File absPath = new File("");.

Notice that the SQLite driver is added to the project in Eclipse (build path, add JAR in the libraries). Again when I run in Eclipse it works fine.

Now I exported the JAR and it does not work anymore. In the command line I get this error: java.lang.ClassNotFoundException: org.sqlite.JDBC. When I unzip the JAR both the database and the driver are in it.

Aucun commentaire:

Enregistrer un commentaire