Java says FileNotFoundException but file exists

前端 未结 10 1502
遇见更好的自我
遇见更好的自我 2020-11-22 10:19

I have an assignment for my CS class where it says to read a file with several test scores and asks me to sum and average them. While summing and averaging is easy, I am hav

10条回答
  •  不要未来只要你来
    2020-11-22 10:47

    Obviously there are a number of possible causes and the previous answers document them well, but here's how I solved this for in one particular case:

    A student of mine had this problem and I nearly tore my hair out trying to figure it out. It turned out that the file didn't exist, even though it looked like it did. The problem was that Windows 7 was configured to "Hide file extensions for known file types." This means that if file appears to have the name "data.txt" its actual filename is "data.txt.txt".

    Hope this helps others save themselves some hair.

提交回复
热议问题