Need help to change default directory. Any Java virtual machine parameter?
Hi all,
I use some java programs, which need JRE 1.5.011.
Using this program i can open a window to perform a download / upload, and a default directory appears (e.g. my documments)
Is there any JVM parameter to define a new default directory? Or any other way to define a new default directory?
Thanks
[333 byte] By [
_zZz_a] at [2007-11-27 3:15:22]

By "default dir" you mean the current working dir? The place where files go if you specify a relative rather than full path?
I think that's in the user.dir System property, but trying to set that on the command line with -D didn't seem to have any effect. You could define your own property, specify it with -D on the command line, and then just prepend that property's value to any file operations you do.
Thanks for answer.
I think i didn't explain well what i needed.
Imagine you are in Internet explorer. You go to File and choose Save As.
a windows appears, with a default directory for saving files.
what happens is that I use a program made in java, with has a similar window. Every time i open it, I'm prompted to save my files in a default directory.
What I would like to do is somehow change this default directory. I thought JRE could have some option for this!!
Thanks again
It defaults to the user home directory. You can try setting
-Dhome.dir="....."
and if that doesn't work, try changing the environment variable for it before starting the process (in *nix it is "HOME", the others I don't know).
Edit: Note though, that this can have other repercussions. If the program uses the Preferences class, then (at least on Unix) the preference entries may have to be newly defined (as they are normally stored as "." files in the users home directory on Unix) among other possible and similar side effects.