File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes build problems and relative paths Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "build problems and relative paths" Watch "build problems and relative paths" New topic

build problems and relative paths

thomas jacob
Ranch Hand

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

So this renders my hardcoded location useless, because when a person downloads my jar and runs the executable the path C:/Program Files/eclipse/workspace/First/Test.xml cannot be found.

How do I overcome this problem?. How I can use a relative file path, which will change with the location of the jar

say I download the jar to C:/sample directory how will the location of the property CONFIG_FILE in MyProperty file reflect to C:/Sample/XML/Test.xml

Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
This article may be of use to you.

Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
I agree. Here's the link:
subject: build problems and relative paths
jQuery in Action, 3rd edition