I have a task in which I put pieces of a sudokuprogram together. Right now I'm trying to get the program to read sudokus from files instead of creating them manually. The problem is that when I try to run the method lesFraFil(readfromfile), I just keep gettings errors like FileNotFoundException, even before I run the program (using Eclipse). The file is there, it's right in the same folder where the .java's and .class' to the program are. I get the feeling the error is actually casued by something completely different than the file not being found, so I don't really understand the error... Can anyone explain what is wrong?
Hi The File may be present, but you lesFraFil method throws a filenotfoundexception. but you calling method doesn't handle it. It is failing at compile time only,not at run time Since you are throwing the exception in your called method(lesFraFil ), the calling method should catch it and do somethg Jhakda
If I become filthy rich, I'll sponsor research for painless dental treatment at Harvard Medical School. Thats why,I'm learning Java.I have 32 teeth, 22 are man made.
Joined: Aug 05, 2005
Well spotted Jhakda. I guess that's what the OP meant when he said 'I just keep gettings errors like FileNotFoundException, even before I run the program'
Method SudokuBrett has to either catch or rethrow all exceptions thrown by the lesFraFil method.
Now the compiler will only complain about FileNotFoundException and IOException, because the other ones are unchecked exceptions. If you don't know what that means, the search on this forum, Google or Wikipedia can tell you all you need to know.