title: Getting NoClassDefFoundError when trying to read excel sheet using Apache poi api
body: <p>Host machine : Ubuntu 18.04 openjdk 10.0.2 2018-07-17</p>
  
  <p>I am trying to read data from an Excel sheet using Apache POI but getting the NoClassDefFoundError.</p>
  
  <p>This is my code : </p>
  
  <pre><code>package readatafromexcel;
  
  import java.io.File;
  import java.io.FileInputStream;
  import java.io.FileNotFoundException;
  
  import org.apache.poi.xssf.usermodel.XSSFSheet;
  import org.apache.poi.xssf.usermodel.XSSFWorkbook;
  
  public class ReadExcel {
  
      public static void main(String[] args) throws Throwable {
          // TODO Auto-generated method stub
  
          try{
  
          //create file object
          File src = new File("/home/nisha/Downloads/files/First/refdata.xlsx");
  
          //create file Input stream object
          FileInputStream reader =new FileInputStream(src);
  
          //create workbook object
          XSSFWorkbook wb  =new XSSFWorkbook(reader);
  
          //create sheet 
          XSSFSheet sheet1=wb.getSheetAt(0);
  
  
          //fetch data from excel
          String rowData =sheet1.getRow(0).getCell(0).getStringCellValue();
  
          //print value
          System.out.println("data"+rowData);
          }
  
          catch  (FileNotFoundException e)
          {
  
          }
  
  
  
      }
  
  }
  </code></pre>
  
  <p>This is the stacktrace :</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/compress/utils/InputStreamStatistics
      at org.apache.poi.openxml4j.util.ZipArchiveThresholdInputStream.&lt;init&gt;(ZipArchiveThresholdInputStream.java:62)
      at org.apache.poi.openxml4j.opc.internal.ZipHelper.openZipStream(ZipHelper.java:180)
      at org.apache.poi.openxml4j.opc.ZipPackage.&lt;init&gt;(ZipPackage.java:104)
      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.&lt;init&gt;(XSSFWorkbook.java:307)
      at readatafromexcel.ReadExcel.main(ReadExcel.java:24)
  Caused by: java.lang.ClassNotFoundException: org.apache.commons.compress.utils.InputStreamStatistics
      at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
      at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
      ... 7 more
  </code></pre>
  
  <p>Following are the libraries linked to the project (using Eclipse IDE):
  <a href="https://i.stack.imgur.com/jOCLd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jOCLd.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/mfIvM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mfIvM.png" alt="enter image description here"></a></p>
  
  <p><em>EDIT</em></p>
  
  <p>After changing the Java to 1.8 I now get this error : </p>
  
  <pre><code>Exception in thread "main" java.lang.IllegalArgumentException: InputStream of class class org.apache.commons.compress.archivers.zip.ZipArchiveInputStream is not implementing InputStreamStatistics.
      at org.apache.poi.openxml4j.util.ZipArchiveThresholdInputStream.&lt;init&gt;(ZipArchiveThresholdInputStream.java:63)
      at org.apache.poi.openxml4j.opc.internal.ZipHelper.openZipStream(ZipHelper.java:180)
      at org.apache.poi.openxml4j.opc.ZipPackage.&lt;init&gt;(ZipPackage.java:104)
      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.&lt;init&gt;(XSSFWorkbook.java:307)
      at readatafromexcel.ExcelReadData.main(ExcelReadData.java:24)
  </code></pre>