I have a Problem. I want to read the sheet name in a xlsx using XSSFWorkbook. I add external JARs in my Project: poi-3.9-jar poi-ooxml-3.11.jar xmlbeans-2.4.0.jar
private static String getSheetName(int page, String file) {
FileInputStream fileInputStream = null;
String name="";
try {
fileInputStream = new FileInputStream(file);
System.out.println(file);
Workbook workbook = new XSSFWorkbook(fileInputStream);
System.out.println(workbook.getNumberOfSheets());
name=workbook.getSheetName(page);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return name;
}
But it throws always this Exception:
java.lang.NoClassDefFoundError: org/apache/poi/UnsupportedFileFormatException
Does anyone know what i forgot? Thanks!