javac: package org.apache.poi.hssf.usermodel does not exist

24,125

Solution 1

/usr/share/java on the classpath does not bring in all jars in /usr/share/java.

Try putting /usr/share/java/jakarta-poi-3.0.2.jar in your classpath instead.

Solution 2

First up, you might want to upgrade - Apache POI 3.0.2 is over 3 years old, and there have been a lot of fixes since then!

As for your issue, you either need to list each jar file individually on your classpath, or you need to place all your jars into the jre lib directory (the contents is which is automatically included). The latter isn't generally recommended though...

You can't just list a directory on the classpath, and have the jars from within it picked up, sorry. Only individual class files will be loaded from a classpath directory, jars won't be

Share:
24,125
Max
Author by

Max

Updated on December 19, 2020

Comments

  • Max
    Max over 3 years

    I have a program attempting to use classes from the jakarta-poi-3.0.2.jar in my /usr/share/java directory:

    import org.apache.poi.hssf.usermodel.HSSFCell;
    import org.apache.poi.hssf.usermodel.HSSFCellStyle;
    import org.apache.poi.hssf.usermodel.HSSFWorkbook;
    etc...
    

    When I compile, I get a package org.apache.poi.hssf.usermodel does not exist error for each of the imports above.

    I have /usr/share/java on my classpath. Am I missing anything else?