0

Possible Duplicate:
Applet not reading file

I have an applet that I am trying to make read a file. It throws a filenotfound exception, but I am passing it the correct path so I am not sure where I am going wrong. I am using this to read numbers and use those numbers to change a multidimensional array, if you were wondering. Heres the code:

public class Save {
    public void loadSave(File loadPath) {
        try {
            Scanner loadScanner = new Scanner(loadPath);

            while(loadScanner.hasNext()){
                for(int y = 0; y < Screen.room.block.length;y++){
                    for(int x = 0; x < Screen.room.block[0].length;x++){
                        Screen.room.block[y][x].groundID = loadScanner.nextInt();
                        System.out.println(loadScanner.nextInt());
                    }   
                }
                for(int y = 0; y < Screen.room.block.length;y++){
                    for(int x = 0; x < Screen.room.block[0].length;x++){
                        Screen.room.block[y][x].airID = loadScanner.nextInt();
                    }   
                }
            }
            loadScanner.close();
        } catch (Exception e) { e.printStackTrace();}
    }
}

How I access it:

save.loadSave(new File(frame.getClass().getResource("mission1.tdm").toString()));
4

0 回答 0