Getting a dreaded FileNotFoundException? You should be aware, when you use a file name like "foo.txt" that this means 'use a file called foo.txt in the current directory. The current directory, particularly when you are running code in a complex ide (the related links for Netbeans and Eclipse might be of interest) might be not at all what you think it is. If in doubt - check it. The code below (source HERE) will do that for you:

public class CurrentDirectory {
    public static void main(String[] args) {
        System.out.printf("Current directory is %s%n", System.getProperty("user.dir"));

Please support this site using the button below: