Stumped by FileNotFound exception

假装没事ソ 提交于 2019-12-20 04:18:12

问题


All I want to do is import data from a text file. The file exists at C:\temp\text.txt. However, I keep getting a file not found error. What the heck am I doing wrong???

public static void main(String[] args) throws IOException {
    String mFilename = "C:\\temp\\text.txt";
    Scanner myDataStream = new Scanner(new File(mFilename));}

回答1:


For the sake of giving this question an answer:

Googling brought up a case where someone had file extensions hidden and his file was actually text.txt.txt. Check if it's not your case.

You can display extensions in Windows 7 by going in Organize > Folder and search option > View and unchecking Hide extensions for known file types from any folder's menu.



来源:https://stackoverflow.com/questions/7409971/stumped-by-filenotfound-exception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!