在java中使用vtd-xml抛出java.lang.UnsupportedClassVersionError

发布于 2024-11-05 08:37:37 字数 348 浏览 7 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

久而酒知 2024-11-12 08:37:37

听起来 vtd-xml jar 文件中的类是 1.6

It sounds like the vtd-xml jar file has classes in it that are 1.6

故事灯 2024-11-12 08:37:37

您可以使用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.

眼睛会笑 2024-11-12 08:37:37

文档说:

当 Java 虚拟机尝试读取类文件并确定文件中的主版本号和次版本号不受支持时抛出。

您正在使用的库必须是使用不同版本的 Java 编译的。

The documentation says:

Thrown when the Java Virtual Machine attempts to read a class file and determines that the major and minor version numbers in the file are not supported.

The library you are using must have been compiled with a different version of Java.

静若繁花 2024-11-12 08:37:37

现在它可以执行 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文