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 开发者_StackOverflow社区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));}
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.
精彩评论