MacOS – How should I manage different version of Java (JRE and JDK) on Mavericks

installjavamacos

I would like to know what the best way would be to have multiple versions of Java (both JRE and JDK) installed on Mavericks, and also the best way to be able to use these version with Eclipse.

Currently I appear to have the following versions of JDK and JRE installed:

  • 1.7.0_45 (/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/bin/)
  • 1.7.0_45 (/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/)
  • 1.6.0_65 (/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/)

As far as I can tell, the two version of 1.7.0_45 are not symlinked to each other.

I am interested in installing a version of Java 8 as well, where and how should I install it to make it play nice with the existing versions?

Best Answer

Eclipse has its own list of JREs that it knows about in Preferences > Java > Installed JREs. When running programs in Eclipse you can choose from this list of JREs.