I recently attempted to rename my project in Eclipse using refactoring, and when I did I ran into many errors. I think I resolved all of them, but now my program is getting stuck while reading in a .xlsx file.
File file = new File("C://Users/user1/ExcelFile.xlsx");
if(!file.getName().endsWith("xlsx")) {
JOptionPane.showMessageDialog(null,
"Please select an Excel file (.xlsx)",
"Error", JOptionPane.ERROR_MESSAGE);
} else {
XSSFWorkbook workbook = null;
try {
// Find the workbook instance for XLSX file
workbook = new XSSFWorkbook(file);
} catch (IOException e) {
Logger.getLogger(
XLSXHandler.class.
getName()).log(Level.SEVERE, null, e);;
}
// Return first sheet from the XLSX workbook
XSSFSheet mySheet = workbook.getSheetAt(0);
// reading sheet into taskList
tasks = readInTasks(mySheet);
}
The problem area seeems to be in the "workbook = new XSSFWorkbook(file);" line because in the debugger, workbook is filled with null values. In my build path, I have included the following .jar files:
- poi-3.15-beta1.jar
- poi-ooxml-3.15-beta1.jar
- poi-ooxml-schemas-3.15-beta1.jar
- xmlbeans-2.6.0.jar
- commons-codec-1.10.jar
- jxl.jar
- stax-api-1.0.1.jar
Any ideas?