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
Code:
false
true
When the file exists in the default working directory, and not in the new one, the output is
Code:
true
false
When it exists in neither it is
Code:
false
false
When it exists in both it is
Code:
true
true
I am modifying an already written program, and if possible would like to avoid changing every file-system call.