-
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.
-
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.