4

I get this error when running my Java application

Global : Unsupported major.minor version 52.0

When I checked my Java version, I found that it was different from the compiler version

java -version
# java version "1.7.0_65"
# OpenJDK Runtime Environment (IcedTea 2.5.1) (7u65-2.5.1-4ubuntu1~0.12.04.2)
# OpenJDK Server VM (build 24.65-b04, mixed mode)
javac -version
# javac 1.8.0_20

How do I downgrade the Java compiler?

3 Answers 3

7

Open a console. Type

sudo update-alternatives --config javac

After entering your root password you can enter the number of a javac with "java-7" in its name.

Edit: You could also update-alternatives --config java to choose a newer JVM that is compatible to Java 8 bytecode.

Sign up to request clarification or add additional context in comments.

Comments

6

You don't need to downgrade the compiler; you just need to tell the compiler to produce classes that a Java 7 JVM will understand. Use the options -source 7 -target 7 when running javac.

1 Comment

5

I'm assuming you are using linux,

sudo update-alternatives --config javac

Then you can type your choice. If you get message like 'There is only one alternative...' then you should type to the terminal

sudo update-alternatives --install "/usr/bin/javac" "javac" "/(your java home)/bin/javac" 1

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.