java 类文件中的错误版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/847652/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 14:02:13  来源:igfitidea点击:

bad version in class file

java

提问by Adhir

When I use certain jars in one of the connector projects i write for lombardi in TeamWorks eclipse i get a bad class version exception...

当我在 TeamWorks eclipse 中为 lombardi 编写的连接器项目之一中使用某些 jar 时,我得到一个错误的类版本异常......

any ideas how this might be resolved..

任何想法如何解决这个问题..

Regards, Adhir

问候, 阿迪尔

回答by Simon Nickerson

You will get this error if you are using (say) Java 1.5 and you are using a JAR compiled with Java 1.6.

如果您使用(例如)Java 1.5 并且您使用的是用 Java 1.6 编译的 JAR,您将收到此错误。

The easiest way to resolve is to upgrade your version of Java to the one used by the JAR.

最简单的解决方法是将您的 Java 版本升级到 JAR 使用的版本。

回答by Luixv

Try to compile/recompile all your stuff with the same compiler. Typically this happens when you have something compiled with a higher version and you try to run it with an older one.

尝试使用相同的编译器编译/重新编译所有内容。通常,当您使用更高版本编译某些内容并尝试使用较旧版本运行它时,就会发生这种情况。

回答by Kirk A

This problem can also be caused by an expired (365-day) Android certificate referenced by Eclipse.

此问题也可能是由 Eclipse 引用的过期(365 天)Android 证书引起的。

See "Debug certificate expired" error in Eclipse Android pluginsfor details.

有关详细信息,请参阅Eclipse Android 插件中的“调试证书已过期”错误

回答by TechSunil

Root Cause for this error is that: jars including in your project is complied from other version of java and you are compiling your project from other version of java simply upgrading version of java will resolve this problem.

此错误的根本原因是:项目中包含的 jars 是从其他版本的 java 编译的,而您正在从其他版本的 java 编译您的项目,只需升级 java 版本即可解决此问题。

I also faced the same problem.

我也面临同样的问题。

回答by Mike Pone

This is a result of running code compiled with a compiler version that is greater than the version of java you are using to run it. IE Code compiled with 1.6 and you are running it with 1.5. See this post to determine what version it was compiled with.

这是运行使用编译器版本编译的代码的结果,该版本高于您用来运行它的 java 版本。用 1.6 编译的 IE 代码,你正在用 1.5 运行它。请参阅这篇文章以确定它是用什么版本编译的。

how-can-i-find-the-target-java-version-for-a-compiled-class

how-can-i-find-the-target-java-version-for-a-compiled-class

the easiest fix is to run it with the most recent JVM.

最简单的解决方法是使用最新的 JVM 运行它。