Jump to content
Excelsior Forums
Sign in to follow this  
Qdex

Problems with the Working Directory on Deployed Applications

Recommended Posts

This is a wierd one!

We're now finding that compiled executables that have been available to our customers for some time are no longer working on the latest releases of Windows Vista and even XP. The problem seems to be related to the working directory, although after many hours of debugging we've not established exactly what the problem is yet.

The application runs fine even in JetPackII trial version, but after deployment it doesn't.

Anyone else having problems here? Perhaps there is something we need to add to the JET build files or even JetPack itself to explicitly set the working directory?

Share this post


Link to post
Share on other sites

Carried out further testing, and rebuilt all of the application in JET from scratch using the JET and JetPack II user interfaces and the Java build text from Intellij IDEA, but problem still remains.

Essentially something is going wrong between the JetPack II trial application (which works fine) and the deployed application installation, which seems not to be able to read/write files in the working directory.

Is anyone else having problems of this nature?

Share this post


Link to post
Share on other sites

How do you determine the working directory in the application code?

Do you use a Java system property, OS env. variable, or something else?

Share this post


Link to post
Share on other sites

Hi zztop,

Good question - I think we're using the $root value in JetPackII, which we're hoping gets automatically set to either the default installation directory or the directory selected by the user during installation.

Is that in itself enough? We don't set any environment variable.

Share this post


Link to post
Share on other sites
I think we're using the $root value in JetPackII, which we're hoping gets automatically set to either the default installation directory or the directory selected by the user during installation.

Is that in itself enough?

Yes, it's enough if you set your own Java system property in JetPackII as

  -Dmy.property=$(Root)

and then get the value of "my.property" in the program.

The next question is if the problem appears when the application is installed into a separate directory, say in "C:\MyApp" not in <system drive>\"Program Files"?

Share this post


Link to post
Share on other sites

Hi zztop,

Now, I may have misled you in my previous email - we note that $root is used by JET. but we don't actually use it in our software - instead we look at this Java property if we need to:

System.getProperty("user.dir")

And in most cases we assume that for any files opened, the Java/JET environment will point to the working directory, e.g:

pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));

Now, when we installed the software to a directory not under 'Program Files' (we used 'C:\TESTDIR') the software worked fine! :-)

Do you know what might be happening then?

Thanks

Share this post


Link to post
Share on other sites
Do you know what might be happening then?

Yes.

The latest Windows security policies do not to allow apps to create files in subfolders of Program Files. That's not about Excelsior JET.

You need to change your code to store output files in another location.

Share this post


Link to post
Share on other sites

Wow! ...and shocking! I guess this might affect a number of your customers then?

We'll be changing our product lines over the next few days...

Thanks for your help in this!

Cheers

Share this post


Link to post
Share on other sites
I guess this might affect a number of your customers then?

I guess many customers changed their code to use Application Data instead of Program Files.

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  

×