title: How to include sqlite db file into jar in netbeans?
body: <p>I use sqlite in my java application. When I run it from Netbeans, it works well. The sqlite db file is located in the root project directory (same level as build.xml).<br>
  This is the code to access the database file:  </p>
  
  <pre><code>DriverManager.getConnection("jdbc:sqlite:database.db");
  </code></pre>
  
  <p>However, when I build the project, and run the jar file outside netbeans, I always get this error: <code>no such table: table_name</code>    </p>
  
  <p>My question: where is the correct location to put the "sqlite db" file? Is it possible to package it inside the JAR file?  </p>
  
  <p>I have tried to package my application into a single JAR file (similar to Eclipse's FatJar), but I still get that error. In this case I modify the build.xml as explained in this blog:<br>
  <a href="http://arnoraps.tweakblogs.net/blog/4300/netbeans-single-jar.html" rel="nofollow">Netbeans single JAR</a>  </p>
  
  <p>I also tried to create a database folder in the src directory and then put the db file inside the folder (src/database/database.db) and access it using  </p>
  
  <pre><code>DriverManager.getConnection("jdbc:sqlite:src/database/database.db");
  </code></pre>
  
  <p>I can run it inside netbeans. But when I run it outside, I got this error:  </p>
  
  <pre><code>path to 'src/database/database.db':C:\Windows\system32\src' does not exist  
  </code></pre>
  
  <p>I know there are similar questions to this in stackoverflow, but most of them don't have a concrete solution. Let me know if someone has found a better one.  </p>
  
  <p>Thanks a lot.</p>