异常边阅读Excel文件的Apache POI [英] exception while reading Excel file with apache poi
问题描述
问题读取Excel 2007文件.xlsx文件延伸,而我试图与Apache POI阅读:
Problem reading Excel 2007 file .xlsx file extention, while I am trying to read with apache poi:
InputStream file = new FileInputStream(C:\\test.xlsx);
---> XSSFWorkbook workbook = new XSSFWorkbook(file);
此行给我一个例外异常线程mainjava.lang.NoClassDefFoundError的:组织/阿帕奇/的XMLBeans / XmlObject中
请,有什么可这个错误的原因是什么?
This line giving me an exception Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlObject
please, what can be cause of this error?
推荐答案
您需要包括一个名为的XMLBeans-xxxjar
自带的文件夹下的your_location_of_poi \\ POI的jar文件-xx \\ OOXML-lib目录\\,在你的类路径。
you need to include a jar file named xmlbeans-x.x.x.jar
that comes under folder "your_location_of_poi\poi-x.x\ooxml-lib\" in your classpath.
请注意: XX
是POI和版本,您正在使用 XXX
是罐子的版本号上述文件夹下的文件
Note: x.x
is the version of poi that you are using and x.x.x
is the version number of that jar file under the above mentioned folder
这篇关于异常边阅读Excel文件的Apache POI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!