I am trying to change my working directory. To that end I created the following test program
Code:
import java.io.File;
public class foo {
public static void main(String[] args) {
System.setProperty("user.dir","/");
String foo="bar";
System.out.println((new File(foo).exists()));
foo=(new File(foo)).getAbsolutePath();
System.out.println((new File(foo)).exists());
}
}
When
/bar exists, the output of this program is
When the file exists in the default working directory, and not in the new one, the output is
When it exists in neither it is
When it exists in both it is
I am modifying an already written program, and if possible would like to avoid changing every file-system call.