java.io.FileNotFoundException:C:\ Engines \ Data.xlsx(系统找不到指定的文件)

问题描述 投票:0回答:2

我的系统中有一个现有文件的数据名称,但它仍然说The system cannot find the file specified.

我试图用所有方法创建一个现有类的对象来读取xlsx文件。

我的代码:

public class sampletestjava {

public static void main(String[] args) {

    System.out.println("learning maven");
    XLS_Reader xls = new XLS_Reader("C:\\Engines\\Data.xlsx");

错误

(java.io.FileNotFoundException):C:\ Engines \ Data.xlsx(系统找不到指定的文件)

java file filenotfoundexception
2个回答
0
投票

尝试保持绝对路径的字符串,如下所示:

  D:/eip_eclipse_workspace/codeTesting/properties/keystore_file/keystore

哪个,就像你的情况一样:

  XLS_Reader xls = new XLS_Reader("C:/Engines/Data.xlsx");

-1
投票
File myFile = new File("C://Engines/Data.xlsx");
            FileInputStream fis = new FileInputStream(myFile);

OR

FileInputStream fis = new FileInputStream(new File("C://Engines/Data.xlsx"));

是否有类似XLS_Reader的类或接口?即使我也在学习,但据我所知,它不是。如果是,请更新我

使用java.io概念为了使用Office文件,您需要了解“Apache POI”。寻找https://www.javatpoint.com/apache-poi-tutorial

希望这可以帮助!

© www.soinside.com 2019 - 2024. All rights reserved.