This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes Executable jar file problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Executable jar file problem" Watch "Executable jar file problem" New topic
Author

Executable jar file problem

thomas jacob
Ranch Hand

Joined: May 19, 2005
Posts: 91
I am creating a executable jar MyJar for my application. I am facing some problems
1) My Application contains a properties file MyProperty.properties which contains a key value pair which reference a location of the file
say
CONFIG_FILE=/XML/Test.xml
This MyProperty file and the Test.xml are also included in my jar file.

When I run the executable jar it cannot find the /XML/Test.xml as well as the jar files inside the MyJar.jar. I have included the xerces.jar in MyJar.jar. How should customize my program to find the files and jar
How do I overcome this problem?.

Regards
Thomas
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35240
    
    7
How are you accessing the resources inside the jar file? Using the java.io package won't work. This article is a bit applet-centric, but it explains in details how to access files stored in the jar file, and that is applicable to applications as well.
[ May 10, 2006: Message edited by: Ulf Dittmer ]

Android appsImageJ pluginsJava web charts
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16483
    
    2

I have included the xerces.jar in MyJar.jar.
This is also not the right thing to do. You should distribute xerces.jar along with MyJar.jar, not inside it, and you should have MyJar.jar's manifest file include a Class-Path entry that points to xerces.jar. If you haven't already seen it, this tutorial explains the process.
[ May 10, 2006: Message edited by: Paul Clapham ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Executable jar file problem
 
Similar Threads
Classpath Issues with java -jar option
How to Find path of a file inside a jar file????
build problems and relative paths
Reading files from classpath searching with a pattern
Problem with the use of external library from a jar archive