File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Unusual FileNotFoundException error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Unusual FileNotFoundException error" Watch "Unusual FileNotFoundException error" New topic

Unusual FileNotFoundException error

Olivier Legat
Ranch Hand

Joined: Nov 17, 2007
Posts: 176

Hello everyone,

I've never used the FileReader class before and I keep getting a FileNotFoundException error at "FileReader fr = new FileReader("test.txt");" even though the file exists. I've tried it by giving the entire filepath and I've tried using several IDEs (since the results can vary from one to another) but I always get the same message. I was thinking it might be an OS problem (I'm with Vista), but it might be a simpler problem. Does anyone have any suggestions?


Vladislav Mkrtychev

Joined: Nov 29, 2008
Posts: 8
Your code works for me...
I get the output of a test.txt.
Olivier Legat
Ranch Hand

Joined: Nov 17, 2007
Posts: 176

Oh no!!! I had named my file "test.txt.txt". There's a setting in Windows that hides file extensions, and I forgot that it was enabled.
It is sorta covered in the JavaRanch Style Guide.
subject: Unusual FileNotFoundException error
It's not a secret anymore!