CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Java and JSP (http://www.codingforums.com/forumdisplay.php?f=54)
-   -   packaging sqlite db with java application (http://www.codingforums.com/showthread.php?t=284291)

greeninho 12-17-2012 03:04 PM

packaging sqlite db with java application
 
Hi guys, I have a java GUI application that I want it to insert and query a sqlite database (sqlite3). Now my application works fine, it connects to the database via (sqlite-jdbc-3.6.20.jar as connector), inserts, retrieves.
So far, I have 10 java objects (10 classes) with another java class that has the main method making all 11 java classes. I have 6 .png image files because of the nature of the application. Below is an analysis of what I have done so far:
-11 java classes
-6 .png file
all in the same folder.
while i have my database file in a folder in my local disk(c:) which i access via my connection object.
Every thing works fine on my system.
Now I want to deploy the application and distribute it, I have to convert my java class(with a main method) to jar file, after that it still works well on my system.
When I copy my application jar file, sqlite-jdbc-3.6.20.jar, and the sqlite db file to a folder and transfer it another system, the java appliction jar runs but throws a classpath not found exception(as in doesn't queries the database neither does it inserts to the database).
I need you guys help on how i will package together this sqlite db with my application for distribution.
NB: I did everything on JCreator.

Fou-Lu 12-17-2012 03:52 PM

You'll need to add any classpaths required (specifically for things like the sqlite jdbc connector) as a part of the manifest. JCreator I'd assume has a way of doing this via the gui when creating the jar.
Check here: http://docs.oracle.com/javase/tutorial/deployment/jar/
And: http://docs.oracle.com/javase/tutori...r/downman.html
Also, you'll probably need to sign it if you are working with filesystem, for that you can follow this tutorial: http://docs.oracle.com/javase/tutori...signindex.html

You'd need to verify the error to be sure, but if its throwing a classpath error my expectation is it cannot load the driver you are using from the sqlite-jdbc connector (which you will also need to provide). The stack trace should tell you which class its attempting to load.

greeninho 12-17-2012 04:41 PM

thanks, am gonna read those tutorial links you provided and anything arises, I will let you know.


All times are GMT +1. The time now is 02:03 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.