当我试图通过java程序访问excel文件时,我收到异常java.io.FileNotFoundException: D:\Selenium Reports\Daily Reports\Merged file.xls
。通过FileInputStream()执行excel文件的java.io.FileNotFoundException
我曾尝试用:
- 绝对路径
- 相对路径
- 读/写文件
- 检查文件是否打开
仍然可以访问,它没有工作,是不是工作,因为我有访客访问机器?
当我试图通过java程序访问excel文件时,我收到异常java.io.FileNotFoundException: D:\Selenium Reports\Daily Reports\Merged file.xls
。通过FileInputStream()执行excel文件的java.io.FileNotFoundException
我曾尝试用:
仍然可以访问,它没有工作,是不是工作,因为我有访客访问机器?
保持的.java文件和的.xls文件在同一个文件夹中,并使用代码:
try {
File f = new File("Merged file.xls");
if (!f.exists()) {
System.out.println("File does not exist");
if (!f.createNewFile())
System.out.println("File cannot be created");
else
System.out.println("File created");
} else {
System.out.println("File exists");
if(!f.canRead())
System.out.println("Error in reading. Need permission");
if(!f.canWrite())
System.out.println("Error in writing. Need permission");
}
} catch (IOException e) {
e.printStackTrace();
}
}
感谢Geet的努力。 –
欢迎,但它工作? –
是的,它为我工作。 –
你最好提供代码。 – Gearon
你正在使用什么构建工具和IDE? –
'FileNotFoundException'表示无法找到该文件。真的没有什么可以说的。 – ifly6