my code is
[...]
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.X
This usually indicates that you somehow drag in outdated XML Parser interfaces, e.g. via some transient dependency to an old xml-api version or an outdated xerces jar, which is usually not needed any more at all as Java 6 provides all the XML parsing functionality out of the box.
See this discusion for some more details.
Recent versions of poi-ooxml
require you to use at least java 6
. The method in question was only added since java 6
. Consider upgrading your java
version.
From the official docs,
The OOXML jars require a stax implementation, but now that Apache POI requires Java 6, that is provided by the JRE and no additional stax jars are required. The OOXML jars used to require DOM4J, but the code has now been changed to use JAXP and no additional dom4j jars are required.
*Emphasis mine.
Since the question was edited, I'm specifying the build this method was added:
java 1.6.0_18
So a minimum of this version must be used in OP's case.
I ran into exactly the same issue as you, and I found the following jar files have to be used to solve the program:
Newer version will bring trouble.