简体   繁体   English

从文本读取文件

[英]Reading file from text

I have tried this a hundred different ways but keep getting a filenotfound... Put it as simple as I could and don't understand it. 我已经尝试了一百种不同的方法,但是一直没有找到filenotfound ...尽可能简单地讲,不要理解它。

File file = new File("C:/files/salesrep.txt");
FileReader fileSC = new FileReader(file);
BufferedReader br = new BufferedReader(fileSC);

The FileReader is giving me a file not found. FileReader给了我一个找不到的文件。 I tried using the directory and get the same. 我尝试使用该目录并获得相同的结果。

Try using path like this, if the file exists the shouldn't be a problem. 尝试使用这样的路径,如果文件存在应该不成问题。

File file = new File("C:\\files\\salesrep.txt");

Also you can here for more specific explanation. 您也可以在此处进行更具体的说明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM