I'm trying to implement reading from .xls file. I have the following code:
FileInputStream file = null;
Workbook workbook = null;
try {
file = new FileInputStream(System.getProperty("user.home") + "/Downloads/" + fileName);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
if (fileName.endsWith(".xls")) {
try {
**workbook = new HSSFWorkbook(file);**
} catch (IOException e) {
e.printStackTrace();
}
This marked code line crashes.
I imported in pom.xml:
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.0</version>
</dependency>
but I got the error: Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream
I would appreciate help on this. Thanks.