• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Executable jar and access to supporting files

 
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Help!
I'm trying to package my project into an executable jar (including my db and policy file which are at the root level of the jar).
The problem is that when I try to run the rmi server
(java -Djava.rmi.server.codebase=file:///c:\scjd\suncertify\db/ -Djava.security.policy=policy suncertify.db.RemoteDataServer db.db localhost)
it won't pick up the policy and/or db file. If I extract these two files and put them in the base application directory (where classpath is set to '.') and enter
java -Djava.rmi.server.codebase=file:///c:\scjd\suncertify\db/ -Djava.security.policy=policy suncertify.db.RemoteDataServer c:\scjd\db.db localhost
--note the change in the db location--
then it works.
I really want to keep this as a simple executable jar with no extracting required.
thanks in advance,
Max
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They're going to have to extract the db file. I don't believe you can access a resource within a jar file for writes.
 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Sajid
What did you do with the other supporting files (policy etc)? Did you leave them embedded in the jar? Did you create a resource bundle?
thanks again,
Max
 
Sajid Raza
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I created a few resource bundles for externalized strings. The resource bundles were placed in the nested (object-code) jar archives (server.jar, client.jar). I also included the resource bundles in the source code directory.
I did not use any policy files. I didn't even justify that I didn't use any policy files, I was too sick of the whole thing at the end. However, I suggest that you do include policy files for the sake of completeness. He will have to extract the policy file.
Regardless, for the examiner to test your submission he is going to need access to the README.txt file which he will have after he extracts the submission jar. In the readme just document the location of the policy file and how to use it. I think the submission jar file serves more to zip all of your submission into a package rather than serve as an executable.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic