aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Executable jar and access to supporting files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Executable jar and access to supporting files" Watch "Executable jar and access to supporting files" New topic
Author

Executable jar and access to supporting files

Max Tomlinson
Ranch Hand

Joined: Jul 17, 2001
Posts: 365
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
Sajid Raza
Ranch Hand

Joined: Jul 13, 2001
Posts: 41
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

Joined: Jul 17, 2001
Posts: 365
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

Joined: Jul 13, 2001
Posts: 41
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Executable jar and access to supporting files