Issue
I have added the external jar that is contained in this zip: http://www.apache.org/dyn/closer.lua/poi/release/src/poi-src-3.14.zip (First link) to my Eclipse Java Project. I want to be able to create and modify existing excel files, so I create a new XSSFWorkBook object. When I click the import tooltip under the XSSFWookBook object it imports: "org.apache.poi.xssf.usermodel.XSSFWorkbook". After that has been added I get a syntax error underlining "org.apache.poi.xssf", The import org.apache.poi.xssf cannot be resolved.
For some reason in the Referenced Libraries tab there's not actually a "xssf" file that exists, but for some reason Eclipse decided to import it. Image of my Eclipse Window
How do I fix the syntax errors occuring when I import XSSFWookBook and why would Eclipse import a package that doesn't appear to exist?
Also I noticed there was a HSSF folder which I've been told is similar to XSSF but is outdated compared to it. If anyone could answer any of my questions or clarify the difference between HSSF and XSSF excel files I would be very grateful.
Solution
Your link points to the sources download. That ZIP does not contain any JARs. You should download from https://poi.apache.org/download.html the poi-bin-3.14.zip
. And you will need all those JARs in the class path. At the moment it lacks the poi-ooxml-3.14-20160307.jar
.
For difference HSSF XSSF read https://poi.apache.org/spreadsheet/index.html.
Good to read also: https://poi.apache.org/spreadsheet/quick-guide.html
For the difference between the src build and the bin build:
The src build is thought for programmers who need the source codes of the apache poi objects. For example if they will fork their own POI project from this. It contains only *.java files, not compiled *.class files or *.jar archives. So with this you must self compile the *.java files and create the *.jar archives.
Since it contains a build.xml also, maybe your Eclipse has used this and compiled and jared automatically. But this is only a guess since I do not use Eclipse.
Programmers who only need to use the apache poi objects should download the bin builds. They contain pre compiled classes in jar archives.
Answered By - Axel Richter
Answer Checked By - Terry (JavaFixing Volunteer)