Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-17-2012, 03:04 PM   PM User | #1
greeninho
New Coder

 
Join Date: Dec 2011
Location: abuja
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
greeninho is an unknown quantity at this point
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.
greeninho is offline   Reply With Quote
Old 12-17-2012, 03:52 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
Fou-Lu is offline   Reply With Quote
Old 12-17-2012, 04:41 PM   PM User | #3
greeninho
New Coder

 
Join Date: Dec 2011
Location: abuja
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
greeninho is an unknown quantity at this point
thanks, am gonna read those tutorial links you provided and anything arises, I will let you know.
greeninho is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:26 PM.


Advertisement
Log in to turn off these ads.