Jump to content
Excelsior Forums
Sign in to follow this  

Resource of relative path cannot be accessed after generating exe file

Recommended Posts

Dear all,

I have a problem for resource of a relative path.

Introduce: I have created an executable Jar file in the folder C:\test\, which will use a resource file language.xml (c:\test\language.xml). In the Java code, I read this xml file using relative path like getXML(".\\language.xml"). It works if I run my application from Eclipse.

Problem: If I enter the folder c:\test and double click the Jar file, it also works well. but if I go to another fold like d:\ and run the command: d:\>"c:\test\abc.jar", it doesn't work, because my application cannot found the file d:\language.xml.

Try to solve: Therefore I used two software (JET and NativeJ) to create exe file to solve this problem. The exe file generated by NativeJ works well if I run the command d:\>"c:\test\abc.jar". It searches language.xml from the folder where the exe file (c:\test) locates. But the exe file generated from JET still searches language.xml from d:\. Therefore, my application always tells me "cannot find language.xml file".

how to solve this problem? Is this a bug of JET?

Thank you very much


Share this post

Link to post
Share on other sites


This is not a bug.

It seems that in your case the simplest way is to use


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this