Results 1 to 2 of 2
  1. #1
    PeonLover is offline Member
    Join Date
    Dec 2007
    Rep Power

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

  2. #2
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Bali, Indonesia
    Rep Power


    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts