Re: Where is the 'default' directory ?
On Aug 16, 9:26 am, Arne Vajh=F8j <a...@vajhoej.dk> wrote:
...
Java does what all other language/platform combinations do - if
you open a file without specifying a directory, then it opens
the file in current directory.
Usually that is not very good.
Better options include:
- open the file in the directory where the application is ...
If the app. is deployed via webstart, this will not work.
I have spent the last few months seeing posts of folks
whose JWS projects had bombed due to Sun tightening down
the developer access to know where code was locally stored
(even for fully trusted apps.).
- open the file in the users home directory which
is available via System.getProperty("user.home")
- if it is readonly then open the file as a ressource
and store it inside the jar file
Your second and third strategies are what I tend to
point them towards.
For the 2nd, I prompt the developer to use a sub-dir
for the sake of avoiding resource collisions. Further
described here..
<http://sdnshare.sun.com/view.jsp?id=2305>
I noted as I prepared that example, that there were
a number of bug reports related to user.home, but
they seemed to be triggered by unusual circumstances
that did not immediately affect my apps.
--
Andrew Thompson
http://pscode.org/