Closed elbosso closed 3 years ago
According to the Oracle Java spec
The user.dir
points to the location the application was called from (i.e. the current working directory).
Thus it may or may not be writable by the user.
The question is what the current working directory is for an application which was launched by double clicking a shortcut or by opening a link in a web browser...
But in any case it is not a good practice to make any assumptions about the current working dir
Well, ok lets say the oracle spec is a bit unclear on this point. However: user.dir
is the current working dir and at times where webstart came from sun, oracle an later on icedtea it always was the users home directory. It is not that uncommon to expect a java desktop application - and webstart apps are exactly that from a users perspective - to start with a current working dir that belongs to the user executing it. The obvious suspect in that case being that users home directory.
Believe me - I came not here to get lectured about good programming practice. I came here because I thought I found a way to prolong the life of java applications that bet on webstart. When i stumbled onto OpenWebstart i naturally assumed it would try and behave like the original webstart as a drop in replacement - if that is not the case, please state so clearly on the Website and the github readme!
I agree with you from the compatibility perspective. Regardless on how useful „user.dir“ is, OWS should try and mimic Oracles behavior as closely as possible.
Some observations on Windows:
Oracle JWS : Dbl-Clk On JNLP : user.dir = dir in which JNLP is contained.
Oracle JWS : Rt-Clk Open with On JNLP : user.dir = c:\windows\system32
Oracle JWS : From commandline >javaws
OWS : All of above cases : user.dir = OWS installation dir where OWS javaws.exe is contained.
Thanks for pointing this out.
We will discuss and create an issue to track internally - either to fix or to document.
fixed in 1.3.2
When an application is started via openwebstart, the SystemProperty "user.dir" should point to a directory owned by the user who initiated that applications execution - or at least in a directory where said user has read/write privileges.
Some applications assume this and try to create files in the current working directory - one notable example being JasperReports:
This problem (and many similar ones) would disappear if the SystemProperty "user.dir" would be set as mentioned above