new to POI, help needed!!

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

new to POI, help needed!!

jzfwang
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: new to POI, help needed!!

Andreas Reichel

On Sun, 2018-09-30 at 14:05 -0700, jzfwang wrote:
> org.apache.commons.compress

You need that library, which is (for any reason) not part of the poi-
package.

Best regards
Reply | Threaded
Open this post in threaded view
|

Re: new to POI, help needed!!

pj.fanning
In reply to this post by jzfwang
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: [hidden email]
For additional commands, e-mail: [hidden email]