【发布时间】:2015-08-20 01:03:33
【问题描述】:
我正在尝试使用以下代码从项目文件夹中读取 .xlsx 文件,但它总是抛出 FileNotFoundException。我已经附上了文件所在的项目结构。
public static void main(String[] args) {
try {
String excelFilePath = "DataModel.xlsx";
File file = new File(excelFilePath);
FileInputStream fis = new FileInputStream(file);
} catch (Exception ex) {
System.out.print(ex);
}
}
【问题讨论】:
-
您应该使用 DataModel.xlsx 而不是 DataModel.txt
-
事实上我只使用了 xlsx。现在修改了
标签: java filereader filenotfoundexception fileinputstream