Reputation: 29174
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?
Upvotes: 4
Views: 13175
Reputation: 157
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
Upvotes: 5
Reputation: 34581
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
.
Upvotes: 6
Reputation: 14541
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.
Upvotes: 7