1 Reply Latest reply: Mar 25, 2010 8:22 AM by 843804 RSS

    Accessing .db file in my JAR

      Hi all!

      I have my application packed in a JAR file.
      I'm trying to access my sqlite fortress.db file, located in the "images" folder +(yeah, images, because the .jpegs are already working fine, so I'm sure that there is no problem with accessing this folder ).+

      I'm using the following code to achieve this:
      URL dbfile = this.getClass().getResource("/images/fortress.db");
      then I use this dbfile to access the database:
      try {
           conn = DriverManager.getConnection("jdbc:sqlite:"+dbfile);
      However this is not working, when I run the JAR file and try to access the .db file, I get the following error:

      java.sql.SQLException: path to  'jar:file:/G:/Uni/Project/Fortress/Desktop/fortress.jar!/images/fortress.db': 'G:\Uni\Project\Fortress\Desktop\jar:file:' does not exist.

      Can I get some advice on this one please? I checked a number of topics here already, but can't figure out the problem :/ .

      Here is a screenshot of my Eclipse directories:

      Here is another screenshot, you can see how my unzipped JAR archive looks like:

      Edited by: CouRagE88 on Mar 25, 2010 2:34 AM