【发布时间】:2020-04-09 20:15:06
【问题描述】:
我无法访问名称中包含空格的文件。
我的代码:
String fileName = "This is my file.txt";
String path = "/home/myUsername/folder/";
String filePath = path + filename;
f = new BufferedInputStream(new FileInputStream(filePath));
我收到FileNotFoundException
【问题讨论】:
-
请在添加新问题时阅读此内容stackoverflow.com/help/how-to-ask
-
文件真的存在吗?
-
另外,请记住 linux 文件系统通常(总是?)区分大小写,所以
"This is my file.txt"与"This is My File.txt"不同。 -
老兄,我刚刚写了一个代码并检查了它。我认为你的文件路径是错误的。
标签: java linux file exception filenotfoundexception