• Post Reply Bookmark Topic Watch Topic
  • New Topic

Executable jar file problem  RSS feed

 
thomas jacob
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Paul Clapham
Sheriff
Posts: 22697
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!