作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在 Java Eclipse 中读取文件。系统似乎找不到该文件。
Here is my code:
import java.util.Scanner;
import java.io.*;
public class whyDo {
public static void main(String[] args) throws IOException {
Scanner input = new Scanner(new File("c:\\Users\\Vanessa\\Downloads\\CompLet\\CompLet\\sales\\austin.txt"));
System.out.println(input);
// TODO Auto-generated method stub
}
}
When I run this code I get:
Exception in thread "main" java.io.FileNotFoundException: c:\Users\Vanessa\Downloads\CompLet\CompLet\sales\austin.txt (The system cannot find the path specified)
请帮忙。提前感谢大家。
最佳答案
由于使用了反斜杠,可以安全地假设操作系统是 Windows 的某个版本,因此大小写并不重要。我建议使用正斜杠(为了可读性),Java 可以处理它们。要读取 zip 文件,请参阅 Read Content from Files which are inside Zip file .
关于java - 线程 "main"java.io.FileNotFoundException : (The system cannot find the path specified) 中出现异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58250858/
我是一名优秀的程序员,十分优秀!