B
Benji
The comments in the File javadoc state the following:
By default the classes in the java.io package always resolve relative
pathnames against the current user directory. This directory is named
by the system property user.dir, and is typically the directory in which
the Java virtual machine was invoked.
Now, I've seen several old threads on various forums asking why user.dir
is read-only, and I believe there was a feature request put in for allowing
user.dir to be modifiable. So, I checked to see if I could set it, and
it turns out I can. And, in fact, if I create a new File like
new File("tmp.txt"), the absolute path name gets changed based on what I
set user.dir to.
However, it seems that at least the native method "open" in FileInputStream
does not use the system property "user.dir". So, my question is, is this
an impossible task? Or is there something else I need to do besides
System.setProperty("user.dir");
By default the classes in the java.io package always resolve relative
pathnames against the current user directory. This directory is named
by the system property user.dir, and is typically the directory in which
the Java virtual machine was invoked.
Now, I've seen several old threads on various forums asking why user.dir
is read-only, and I believe there was a feature request put in for allowing
user.dir to be modifiable. So, I checked to see if I could set it, and
it turns out I can. And, in fact, if I create a new File like
new File("tmp.txt"), the absolute path name gets changed based on what I
set user.dir to.
However, it seems that at least the native method "open" in FileInputStream
does not use the system property "user.dir". So, my question is, is this
an impossible task? Or is there something else I need to do besides
System.setProperty("user.dir");