Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

First of all, I'd like to point out that I am aware 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.0 occurs, 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:

Fig. 1. JDK Compliance

Fig. 1. JDK Compliance

Fig. 2. JRE Setting

Fig. 2. JRE Setting

Fig. 3. Java Home

Fig. 3. Java Home

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

like image 543
brain56 Avatar asked May 13 '14 06:05

brain56


People also ask

How do I fix Java Lang UnsupportedClassVersionError in Java?

UnsupportedClassVersionError happens because of a higher JDK during compile time and lower JDK during runtime. How can i make above change? Project -> Properties -> Java Compiler Enable project specific settings. Then select Compiler Compliance Level to 1.7, 1.6 or 1.5, build and test your app.

What is Major Minor version in Java?

minor version error is thrown in Java when a class is compiled using a higher version of the Java Development Kit (JDK) but executed on a lower version of the Java Runtime Environment (JRE). The exact cause is printed on the version e.g. in the case of major.

What is UnsupportedClassVersionError in Java?

Class UnsupportedClassVersionErrorThrown 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.

When my class and counters UnsupportedClassVersionError which options could resolve this issue?

1) If you encounter UnSupportedClassVersionError, check the JRE version you are using to run program and switch to higher version for quick solution.


1 Answers

The JAVA_HOME environment 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.

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.

like image 98
Jon Skeet Avatar answered Sep 20 '22 00:09

Jon Skeet