如何让Apache POI和JAXB协同工作? [英] How do I get Apache POI and JAXB to work together?

查看:111
本文介绍了如何让Apache POI和JAXB协同工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlObject

运行代码时出现错误。好吧,那很好 - 我只是忘了获得XMLBeans ......但它已经退役了,我在他们的档案中找不到最近的版本。所以我发现JAXB可以替代,我下载并尝试将jar文件添加到Intellij中的库中,但是我仍然遇到同样的错误,寻找XMLBeans依赖。

I get that error when I run my code. Ok, that's fine - I just forgot to get XMLBeans... but it's been retired and I can't find a recent version in their archives. So I found that JAXB can be an alternative, I downloaded it and tried adding the jar files to my library in Intellij, but I still get the same error looking for the XMLBeans dependency.

如何让Apache POI使用JAXB代替XMLBeans?为什么JAXB有7个不同的jar文件,我无法找到它们中的任何一个?我只是想处理一些excel文件,而不是疯狂追逐:(

How do I get Apache POI to use JAXB in place of XMLBeans? Why does JAXB have like 7 different jar files and I can't find out what any of them do? I just want to work on some excel files and not go on a wild goose chase :(

推荐答案

XMLBeans是Apache的依赖项POI和POI不会使用不同的库.XMLBeans包含在我检查过的Apache POI下载中,所以你应该可以使用它。你只需要确保xmlbeans jar文件在java类路径中在运行您的应用程序时。

XMLBeans is a dependency of Apache POI and POI won't use a different library in it's place. XMLBeans comes packaged in the Apache POI downloads which I have checked, so you should have it available to you. You just need to ensure the xmlbeans jar file is in the java classpath when running your application.

我已经检查了最新的POI二进制tar.gz文件'poi-bin-3.14.tar.gz',可从 http://poi.apache.org/download.html#POI-3.14 ,解压缩压缩的tar档案(我使用7-Zip),你会在poi-3.14 / ooxml-lib目录中找到xmlbeans-2.6.0.jar。

I have checked the latest POI binary tar.gz file 'poi-bin-3.14.tar.gz' available from http://poi.apache.org/download.html#POI-3.14, extracting the compressed tar archive (I use 7-Zip), you will find xmlbeans-2.6.0.jar in the poi-3.14/ooxml-lib directory.

这篇关于如何让Apache POI和JAXB协同工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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