Results 1 to 2 of 2
Thread: FileNotFoundException
- 12-26-2007, 04:56 AM #1
Member
- Join Date
- Dec 2007
- Posts
- 1
- Rep Power
- 0
FileNotFoundException
I'm getting a FileNotFoundException on the compile
F1 = fc1.getSelectedFile();
F2 = fc2.getSelectedFile();
in1 = new FileReader(F1);
in2 = new FileReader(F2);
When I check F1.getAbsolutePath() it is the correct path if I just run the program without the in1 and in2 declarations (this is where the errors are)
Wondering what the problem could be. All the variables are declared outside of this block so thats not the problem.
Thanks for any help.
- 12-26-2007, 06:15 AM #2
Senior Member
- Join Date
- Jun 2007
- Location
- Bali, Indonesia
- Posts
- 696
- Rep Power
- 6
This error happens because you forget to put the code inside a try .. catch block. The FileReader constructor throws a FileNotFoundException so that you need to catch it properly.
Website: Learn Java by Examples


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks