特殊的 Eclipse java.lang.UnsupportedClassVersionError,不支持的major.minor 版本 52.0

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23624038/
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-08-14 00:22:23  来源:igfitidea点击:

Peculiar Eclipse java.lang.UnsupportedClassVersionError, Unsupported major.minor version 52.0

javaeclipsetelegram

提问by brain56

First of all, I'd like to point out that I amaware that this question has been asked countless times and I am aware of the usual solution. However, it doesn't seem to work for me.

首先,我想指出的是,我清楚,这个问题已经被问了无数次,我知道通常的解决办法的。但是,它似乎对我不起作用。

When the error Exception in thread "main" java.lang.UnsupportedClassVersionError: org/telegram/mtproto/state/ConnectionInfo : Unsupported major.minor version 52.0occurs, it is generally caused by compiling with an incompatible JDK-JRE combination. However, as shown by the images below, my setup seems to be in order:

出现错误Exception in thread "main" java.lang.UnsupportedClassVersionError: org/telegram/mtproto/state/ConnectionInfo : Unsupported major.minor version 52.0时,一般是用不兼容的JDK-JRE组合编译造成的。但是,如下图所示,我的设置似乎是有序的:

Fig. 1. JDK Compliance

图 1. JDK 合规性

Fig. 1. JDK Compliance

图 1. JDK 合规性

Fig. 2. JRE Setting

Fig. 2. JRE Setting

Fig. 2. JRE Setting

图 2. JRE 设置

Fig. 3. Java Home

Fig. 3. Java Home

Fig. 3. Java Home

图 3. Java 主页

What seems to be the problem? What am I missing?I'm using Eclipse Luna, trying to run some Telegram APILayer 11 code (the code works I reckon, as it was used by others).

似乎是什么问题?我错过了什么?我正在使用Eclipse Luna,试图运行一些Telegram APILayer 11 代码(我认为该代码有效,因为它被其他人使用)。

采纳答案by Jon Skeet

The JAVA_HOMEenvironment variable is irrelevant to how Eclipse will run code, as far as I'm aware. Likewise the compiler settings you've shown for a project don't affect how code is run.

JAVA_HOME环境变量无关,Eclipse会如何运行代码,据我所知。同样,您为项目显示的编译器设置不会影响代码的运行方式。

Instead, you need to look at the Run Configuration you're using when you run it, and check the environment there. Make sure you're using Java 8, and all should be well. Click on the triangle next to the Run button, and select "Run Configurations..." to open the dialog with all the settings. Then look at the JRE tab, and ensure you're using the right JRE.

相反,您需要查看运行时使用的运行配置,并检查那里的环境。确保您使用的是 Java 8,并且一切正常。单击“运行”按钮旁边的三角形,然后选择“运行配置...”以打开包含所有设置的对话框。然后查看 JRE 选项卡,确保您使用的是正确的 JRE。

回答by Fakher

i see that you have a 32bits JDK version for the JDK 1.8 and a 64bits version for the JDK 1.7 i you running your project on a 64bits machine try to use the 64bits version of JDK 1.8 Note: you must have a 64bits version for eclipse too

我看到你有一个 32 位版本的 JDK 1.8 和一个 64 位版本的 JDK 1.7 你在 64 位机器上运行你的项目尝试使用 64 位版本的 JDK 1.8 注意:你也必须有 64 位版本的 Eclipse