Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unusual FileNotFoundException error

 
Olivier Legat
Ranch Hand
Posts: 176
Chrome Mac Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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?

Thanks
 
Vladislav Mkrtychev
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code works for me...
I get the output of a test.txt.
 
Olivier Legat
Ranch Hand
Posts: 176
Chrome Mac Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic