java 不支持的major.minor 版本52.0 - 同时使用较低版本进行编译。怎么还是不好?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26155174/
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
Unsupported major.minor version 52.0 - while using a lower version to compile. How is it still going bad?
提问by JoshBreece
I get this error message when I try to run my program:
当我尝试运行我的程序时收到此错误消息:
Exception in thread “main” java.lang.UnsupportedClassVersionError, Unsupported major.minor version 52.0
I am using Eclipse. I tried going to Windows -> Preferences -> Compiler and changing my Compiler compliance level to a lower version, all the way down to 1.3, the lowest. I also tried configuring the project specific settings and doing the same thing.
我正在使用 Eclipse。我尝试转到 Windows -> Preferences -> Compiler 并将我的 Compiler 合规性级别更改为较低版本,一直降至最低的 1.3。我还尝试配置项目特定的设置并做同样的事情。
I checked my Java version and I am running 1.7.
我检查了我的 Java 版本,我运行的是 1.7。
52 should be JDK 8 I believe, but if I compiled it in 1.3, why is it saying I'm using JDK 8?
我相信 52 应该是 JDK 8,但是如果我在 1.3 中编译它,为什么它说我使用的是 JDK 8?
Sorry there are other questions like this, but none of their solutions have worked for me.
对不起,还有其他类似的问题,但他们的解决方案都没有对我有用。
回答by Jens
It doesn't say that you running on JDK1.8. One class do you use is comiled with java 8. Look at the line after the exception. There should you see wich class it is. I think it is a third party library.
这并不是说您在 JDK1.8 上运行。你使用的一个类是用java 8编译的。查看异常后的行。你应该看到它是哪一类。我认为它是第三方库。
回答by Krease
You're compiling with a higher version of JDK than you're running with. Make sure the version you're compiling with and running with are the same. Another potential cause is that you might be depending on some jars that are compiled with the newer JDK.
您正在使用比运行时更高版本的 JDK 进行编译。确保您编译和运行的版本相同。另一个潜在原因是您可能依赖于使用较新的 JDK 编译的某些 jar。