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

brain56 picture brain56 · May 13, 2014 · Viewed 30.8k times · Source

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).

Answer

Jon Skeet picture Jon Skeet · May 13, 2014

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.