简体   繁体   中英

Source not found error in Eclipse while debugging

I get below error and while debugging. When I put a breakpoint and debugging throws a ' source not found ' error.

I already clicked on "Edit Source Lookup Path" in Eclipse and add my project. but its not working. Please suggest

Exception in thread "main" java.lang.NullPointerException
error line String value = cell.getStringCellValue();


     package ExcelPractice;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFEvaluationWorkbook;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class ExcelTest {    
    public static void main(String[] args) throws IOException {     
     String value = getExcelData("sheet1",2,2);
     System.out.println(" Cell Value " + value);     
    }   
    public static String getExcelData( String sheetName , int rowNum ,int cellNum) throws IOException{      
         FileInputStream fInput = new FileInputStream("C:\\Users\\xxxx\\Excel Data.xlsx");
         XSSFWorkbook wb = new XSSFWorkbook(fInput);
         XSSFSheet sheet = wb.getSheet(sheetName);
         XSSFRow row = sheet.getRow(rowNum);
         XSSFCell cell = row.getCell(cellNum);//breakpoint is here
         String value = cell.getStringCellValue();      
        return value;
    }
}

error screenshot在此处输入图片说明

在此处输入图片说明

在此处输入图片说明 在此处输入图片说明

For classes in the standard Java Runtime, the easiest, simplest answer is always going to be to install a JDK, and to compile and run your Java Applications using it. Your Installed JREs preference page should ideally only list JDKs.

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