在java中使用vtd-xml抛出java.lang.UnsupportedClassVersionError
我有一个 Ear 应用程序,其中包含两个 EJB 和一个 WEB(war)项目,全部使用编译器合规性 1.5。在我的 Web 项目中,我创建了一个实用程序类文件,该文件采用 xml 文件的字节数组并使用 vtd-xml 库 v2.10 返回一些字符串值,并且我在 servlet 中实例化此类的对象。在调用对象的构造函数(采用字节数组)时,我收到错误:
java.lang.UnsupportedClassVersionError: Bad version number in .class file
当我从类中删除所有与 vtd-xml 相关的对象时,我不会收到此错误。任何建议将不胜感激。
问候
I have an ear app with two EJB and one WEB (war) projects all using compiler compliance 1.5. In my web project I created a utility Class file that takes a byte array of an xml file and returns some string values using the vtd-xml library v2.10 and I instantiate an object of this class in a servlet. At the call of the constructor of the object (that takes a byte array) I get the error:
java.lang.UnsupportedClassVersionError: Bad version number in .class file
When I remove all vtd-xml related objects from the class I do not get this error. Any advice would be appreciated.
Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
听起来 vtd-xml jar 文件中的类是 1.6
It sounds like the vtd-xml jar file has classes in it that are 1.6
您可以使用build.bat文件(包含在vtd-xml.zip中)重新编译以获得新的vtd-xml.jar。
you can recompile using the build.bat file (included with vtd-xml.zip) to obtain a new vtd-xml.jar.
文档说:
您正在使用的库必须是使用不同版本的 Java 编译的。
The documentation says:
The library you are using must have been compiled with a different version of Java.
现在它可以执行 build.bat 文件(包含在 vtd-xml.zip 中),但您需要将目标版本编辑为 1.5 而不是 1.6
Now it works executing build.bat file (included with vtd-xml.zip) but you need to edit the target version to 1.5 instead of 1.6