Trying to create a class that writes to an Excel file.
Error( https://gyazo.com/8d8977786add756057bb1d32866942df ): java.lang.ClassNotFoundException: org.apache.commons.collections4.ListValuedMap
Libaries I have added ( https://gyazo.com/cfa1555bd58de436bc243f1067b9e08b ): poi-3.16.jar, poi-ooxml-3.16.jar, poi-ooxml-schemas-3.16.jar, commons-collections4-4.0.jar, xmlbeans-2.3.0.jar
public void Create(){
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.createSheet(("Results"));
try {
FileOutputStream stream= new FileOutputStream(filelocation);
workbook.write(stream);
workbook.close();
}
catch (FileNotFoundException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
}
}
You need a more recent version of commons-collections4. If you look at the Javadocs for ListValuedMap
, you'll see that it was introduced in version 4.1, and you have 4.0 on your classpath.
You should consider using Maven or another dependency management tool as it will save you a lot of headaches.
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.