Today I've started to get this warning in the console, when I try to compile my programs with javac:

warning: Blabla.class: major version 52 is newer than 51, the highest major version supported by this compiler.

it is recommended that the compiler be upgraded.

But how can I do that?

PS. command javac -version returns 1.7.0_85, while java -version returns 1.8.0_66. I do not know how this mixture has happened.

  • Edit your question and add the output of javac -version
    – A.B.
    Nov 12, 2015 at 6:27
  • @A.B. I've done that.
    – Jacobian
    Nov 12, 2015 at 6:30
  • 1
    Try this command and check, if you can change the active javac version sudo update-alternatives --config javac
    – A.B.
    Nov 12, 2015 at 6:33
  • I see two alternatives - for java 7 and for java 8.
    – Jacobian
    Nov 12, 2015 at 6:36
  • 1
    Select Java 8. Use the same version as for java.
    – A.B.
    Nov 12, 2015 at 6:37

1 Answer 1


You have more than one Java version installed and you are using different versions for java and javac. javac -version returns 1.7.0_85, while java -version returns 1.8.0_66. This means that javaccreates bytecode for Java 7 and you try to compile a version for Java 8.


sudo update-alternatives --config javac

and select Java 8 to solve your problem.

  • It was giving me an error that I had no alternative javac available. I was able to solve the issue by following the marked answer of this question.
    – Sufian
    Mar 29, 2021 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.