异常边阅读Excel文件的Apache POI [英] exception while reading Excel file with apache poi

查看:191
本文介绍了异常边阅读Excel文件的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆