1

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.

ocram
  • 1,384
  • 6
  • 20
  • 36
  • Is it some sort of all-in-one über-jar where the included jars are busted out into their own classes? – Dave Newton Dec 04 '15 at 19:04
  • well the driver for sqlite is a jar and yes it is in the jar that i'm trying to run. – ocram Dec 04 '15 at 19:05
  • The *jar* is in the jar, or the jar's *classes* are in the jar? – Dave Newton Dec 04 '15 at 19:12
  • In other words, http://stackoverflow.com/q/9573868/438992 or http://stackoverflow.com/q/12341993/438992. – Dave Newton Dec 04 '15 at 19:13
  • the jar (the sqlite driver) is in the jar (my exported project) in a lib folder – ocram Dec 04 '15 at 19:21
  • it seems to work if I create a Runnable JAR file and put the SQLite database in the same folder as the Runnable JAR file. Is there a way to keep the db within the JAR? – ocram Dec 04 '15 at 19:26
  • *"Is there a way to keep the db within the JAR?"* - That is a different question. Please [search](https://www.google.ca/?gws_rd=ssl#q=java+sqlite+database+in+jar), and if you still need help then [edit] this question to reflect what you are *really* asking (now). – Gord Thompson Dec 04 '15 at 23:00

0 Answers0