Search code examples
javamacos

How should I upgrade my Java compiler after getting error message: major version 51 is newer than 50


When I run $ javac Simulator.java then I get the following warning:

warning: ./particle_simulator/Atom.class: major version 51 is newer than 50, the highest major version supported by this compiler.

I don't know why I suddenly get this warning as I haven't made substantial changes to my code. Nevertheless, how do I upgrade my Java compiler?

I'm running Mac OSX 10.7.5 and my Java version is below:

java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

Solution

  • Download the JDK from Oracle: http://www.oracle.com/technetwork/java/javase/downloads/ . Make sure you get the OSX version. It has its own installer so installation should be pretty straight forward.