【问题标题】:The method setExcelFile(String, String) is undefined for the type ExcelUtils对于 ExcelUtils 类型,方法 setExcelFile(String, String) 未定义
【发布时间】:2017-09-06 07:38:51
【问题描述】:
// Declaring the path of the Excel file with the name of the Excel file
            String sPath = "E:\\Practice_space\\MyKDTTest\\src\\dataengine\\DataEngine.xlsx";

            // Here we are passing the Excel path and SheetName as arguments to connect with Excel file 
            ExcelUtils.setExcelFile(sPath, "TestSteps");

上面的代码我在java的主类中提到过。我正在调用已在其他类中定义的方法 setExcelFile,如下所示

public static void setExcelFile(String Path,String SheetName) throws Exception {
        FileInputStream ExcelFile = new FileInputStream(Path);
        ExcelWBook = new XSSFWorkbook(ExcelFile);
        ExcelWSheet = ExcelWBook.getSheet(SheetName);
       }

但是我遇到了一个错误,请帮助我,在此先感谢

【问题讨论】:

标签: java selenium


【解决方案1】:

“简单”:编译器在编译上述代码时看到的类ExcelUtils包含该方法定义。

换句话说:您的设置中有问题。例如,当您 更改 类的 java 源代码时,可能会发生此类事情 - 但您忘记编译它。或者您忘记重新构建您的 JAR 存档。

长话短说:您的设置存在某种不一致。由于我们无法深入了解该设置,因此这里只能说这些!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-26
    • 2020-05-05
    • 1970-01-01
    • 1970-01-01
    • 2015-11-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多