Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S: Accessing the database file from the final runme.jar

 
ciaran_cahill
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Maybe this has been asked already, but when you package the project for submission in the runme.jar, obviously you need to access the .db database file from the jar as opposed to directly from an ordinary file.

What is the best way to do this?
At the moment I am extracting the database file from the jar if it doesn't exist, and using this on subsequent runs.
The alternative would be to extract it and then write it back into the jar but I don't think this is a requirement. Or maybe this is incorrect?
Any ideas?
Thanks
 
Alex Belisle Turcot
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

runme.jar is a runnable jar containing your classes.. It should be packaged in another jar along with the database file (and other files: instructions.html, choices.txt, userguide.txt...).

When the higher level jar is unpacked, runme.jar and the database file will be at the same level in your directory.

Check your instructions for the exact list of files..

Regards,
Alex
 
ciaran_cahill
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes but won't you still have to extract the database file to use it, even if it is in the 'outer' jar?
For the first run of the program the user won't have the database file.
 
Alex Belisle Turcot
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

the "outer" jar will be extracted by SUN. Thus, the database file will be extracted and will be at the same level as runme.jar.

SoonToBeExtracted.jar
- runme.jar
- db-x.db
- ...

Then, you run "runme.jar" as usual, and select the database where it was extracted (same directory as runme.jar).

Regards,
Alex
[ January 03, 2008: Message edited by: Alex Belisle Turcot ]
 
Ciaran Cahill
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alex
Thanks you're a legend. This is what I was wondering about. I thought you would have to make the project runnable from the outer jar....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic