From: Charles R. <creis@u.washington.edu> - 2004-03-10 08:00:53
|
Unfortunately, we've investigated this before, and that approach only=20 works the first time you change the "user.dir" property. It's also=20 explicitly (purposely) undocumented in the JVM specs, so there are=20 likely JVMs that do not implement this behavior. (I haven't tried it on=20 Apple's JVM.) There are many discussions about the issue on=20 groups.google.com and the Java forums, but it boils down to the fact=20 that this approach isn't reliable or recommended... Charlie Jonathan Lugo wrote: > In terms of implementation, I believe it is quite easy to=20 > programmatically change the default abstract path used by most file IO.= =20 > The java.io.File class uses the System property, =93user.dir=94 when=20 > determining the file=92s absolute path. This property is easily change= d=20 > by using the following code: >=20 > =20 >=20 > System.setProperty(=93user.dir=94, =93<<default directory>>=94);. >=20 > =20 >=20 > I ran the following code in the interactions pane and it successfully=20 > changed the output of the getAbsolutePath() method of a java.io.File=20 > object. It also worked on java=92s XML parser. If this system change=20 > could be made in the interactions pane, could it be done as easily=20 > behind the scenes by drjava? We could have some sort of code that=20 > chooses a good default based on the open/selected files that can be=20 > overruled by the user easily. There could be a =93change current worki= ng=20 > directory=94 button on the interactions pane. This concept could also = be=20 > applied to Unit testing just incase. >=20 > =20 >=20 > I admit that I have not thoroughly researched the repercussions of=20 > changing this system property, but I know the change lasted only until = I=20 > reset the interactions pane again. >=20 > =20 >=20 > - Jonathan Lugo >=20 |