简体   繁体   中英

The method setExcelFile(String, String) is undefined for the type ExcelUtils

// 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");

The above code i have mentioned in main class of java. I am calling the method setExcelFile which was already defined in the other class as bellow

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

But I am getting an error, please help me, thanks in advance

"Simple": the class ExcelUtils that the compiler is seeing when compiling the above code does not contain that method definition.

In other words: something in your setup is wrong. Such things can happen for example when you change the java source of a class - but you forget to compile that. Or you forget to re-build your JAR archive.

Long story short: there is some sort of inconsistency in your setup. As we don't have insight into that setup, that is all that can be said here!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM