Results 1 to 7 of 7
- 07-22-2013, 12:34 AM #1
Member
- Join Date
- Apr 2011
- Posts
- 19
- Rep Power
- 0
Make a runnable jar of my project in Eclipse
I have a Java swing project which i need to test on other computers. I have some classes and a sqlite db which stores login information. I have some lib jars as well. The application takes information from the user and stores it in the sqlite db and then pushes data to the web. I want to package my project so that whoever uses my project has to just double click on an executable or jar. Here is my folder structure -
Java Code:root >src >default package >rest package >images >lib >file.fcl >db.sqlite
I tried to Export to a Runnable Jar file in Eclipse but this does not give desired results. After the runnable jar is created and i run it for the first time it creates the sqlite db beside it and is not able to read the fcl file.
How can i package my data properly?
- 07-22-2013, 11:37 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
Re: Make a runnable jar of my project in Eclipse
If the sqllite db needs to be written to (and your requirements imply it is) then you will need to copy the db file from the jar to the machine.
What's the fcl file?
What error do you get trying to read it?Please do not ask for code as refusal often offends.
** This space for rent **
- 07-22-2013, 12:04 PM #3
Member
- Join Date
- Apr 2011
- Posts
- 19
- Rep Power
- 0
Re: Make a runnable jar of my project in Eclipse
After the user provides user creds it gets written to the sqlite db. As i told after creating the runnable jar, if i execute it it creates a db.sqlite file beside it and pushes login data into it.
I am using a java fuzzy logic controller package. This package has a fcl file which it reads to generate a factor. This fcl file has all the fuzzy rules. After i create the jar file from the Export -> Java -> Runnable Jar File, and try to execute it from cmd by java -jar app.jar, the execution hangs after login credentials are provided and throws error -
Error reading file 'file.fcl'
Cant load file 'file.fcl'
- 07-22-2013, 01:00 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
Re: Make a runnable jar of my project in Eclipse
Then somewhere you (or a package you are using) is not printing the stack trace on an exception properly.
Without it you will be left to guess what the problem with the fcl file is.
For the SQL Lite db then, I take it this is working OK? Because that's what I would expect your app to do with a writeable database.Please do not ask for code as refusal often offends.
** This space for rent **
- 07-22-2013, 02:36 PM #5
Member
- Join Date
- Apr 2011
- Posts
- 19
- Rep Power
- 0
Re: Make a runnable jar of my project in Eclipse
I had thought migrating into a runnable jar in Eclipse would include all the files in the project except the java code. That is why i was expecting that the sqlite and the fcl file would be included within the jar. But i think it is not. I wanted the application to write into the sqlite db which should be within the jar itself. But if thats not possible then the additional sqlite file beside the jar is also fine.
I also tried to keep the file.fcl in the folder but to no good. This runs fine in Eclipse but i dont know why it is not if i make a runnable jar. Is there any alternative ?
- 07-22-2013, 02:49 PM #6
Just a guy
- Join Date
- Jun 2013
- Location
- Netherlands
- Posts
- 5,114
- Rep Power
- 13
Re: Make a runnable jar of my project in Eclipse
Why guess? Open the jar in your favorite zip tool and see for yourself.
The database can be in the jar - but then you can't write to it. If you want to write to your database you'll have to copy it out of the jar ("unpack" if you will) to the local file system. Or create a database from scratch in stead of pre-packaging it in your jar.
- 07-22-2013, 03:00 PM #7
Member
- Join Date
- Apr 2011
- Posts
- 19
- Rep Power
- 0
Similar Threads
-
Make a single Runnable JAR file out of multiple packages
By blackz in forum EclipseReplies: 3Last Post: 05-07-2012, 07:07 PM -
Trying to make runnable jars
By mwr1976 in forum New To JavaReplies: 18Last Post: 04-16-2012, 03:24 PM -
Runnable Jar Export cant make more than one JFrame
By oinca in forum Advanced JavaReplies: 5Last Post: 12-29-2011, 07:48 PM -
Can not make a runnable jar of my project
By liran in forum Advanced JavaReplies: 5Last Post: 05-18-2010, 12:25 PM -
How to make a runnable jar with necessary libraries
By Atriamax in forum New To JavaReplies: 2Last Post: 10-27-2009, 11:36 PM
Bookmarks