被FileNotFound异常困扰 [英] Stumped by FileNotFound exception

查看:157
本文介绍了被FileNotFound异常困扰的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要做的就是从文本文件导入数据。该文件存在于C:\ temp \ text.txt中。但是,我一直收到文件未找到错误。我到底做错了什么???

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));}


推荐答案

为了给这个问题一个答案:

For the sake of giving this question an answer:

谷歌搜索提出了一个案例,其中有人隐藏了文件扩展名,他的文件实际上是 text.txt.txt 。检查是不是你的情况。

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.

您可以通过组织>来显示Windows 7中的扩展程序。 <文件夹和搜索选项>从任意文件夹的菜单中查看并取消选中隐藏已知文件类型的扩展名

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.

这篇关于被FileNotFound异常困扰的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆