Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change java compiler version

Tags:

java

javac

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?

like image 375
Santhosh Avatar asked Dec 03 '22 18:12

Santhosh


1 Answers

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.

like image 167
llogiq Avatar answered Dec 17 '22 04:12

llogiq