Discussion:
new to POI, help needed!!
jzfwang
2018-09-30 21:05:06 UTC
Permalink
I wrote a very short code to use POI, but failed. Help is greatly
appreciated!

I could not even run this short codes.

I have downloaded the newest version of Apache files, including:
poi-4.0.jar, poi-ooxml-4.0.0.jar; poi-ooxml-schemas-4.0.0.jar,
xmlbeans-3.0.1.jar, and commons-collection4-4.2.jar
------------------------------------------------------------------
import java.io.FileInputStream;
import java.io.IOException;

import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class POIExcel {

public static void main(String[] args) throws IOException {
FileInputStream fis = new
FileInputStream("C:/Users/xxxx/Desktop/Input.xlsx");

Workbook wb = new XSSFWorkbook(fis);
--------------------------------------------------------
Here is the error message:

Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/commons/compress/archivers/zip/ZipFile
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:298)
at org.apache.poi.ooxml.util.PackageHelper.open(PackageHelper.java:37)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:307)
at TestNG_Project.POIExcel.main(POIExcel.java:14)
Caused by: java.lang.ClassNotFoundException:
org.apache.commons.compress.archivers.zip.ZipFile
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 4 more





--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-User-f2280730.html

---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@poi.apache.org
For additional commands, e-mail: user-***@poi.apache.org
Andreas Reichel
2018-10-01 15:14:36 UTC
Permalink
Post by jzfwang
org.apache.commons.compress
You need that library, which is (for any reason) not part of the poi-
package.

Best regards
pj.fanning
2018-10-01 17:53:19 UTC
Permalink
https://commons.apache.org/proper/commons-compress/download_compress.cgi -
download v1.18



--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-User-f2280730.html

---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@poi.apache.org
For additional commands, e-mail: user-***@poi.apache.org

Loading...