Press "Enter" to skip to content

Installing Java on Mac OS X 10.10 Yosemite and 10.11 El Capitan


Update (September 11, 2015): now that 10.11 El Capitan is in public GM Candidate I installed it and updated this post. The problem with JDK 7 is gone, the latest installer works fine.

Update (February 24, 2015): this post was written during the public beta period, but everything applies for the stable version of OS X 10.10 Yosemite, so I removed “(Beta)” from the end of the title.

So I had to install Java on Yosemite (Beta). I went with the usual method of typing java in the Terminal, and I got the popup, that Java is not installed, go and download it for yourself. The link takes you to the JDK 8 download page. No problems here, but what if you need Java 6 or 7?

You might have a hard time finding a JDK 6 out there (I had), then fortunately I started IntelliJ IDEA 13 and I got an OS popup, telling me to download and install Java 6 from this link. Nothing complicated here. This was the last Java version bundled with Mac OS X by Apple.

There is no problem with installing JDK 7 (Update 79 and up) anymore, just download the installer and run it. For the record when Yosemite came out Update 65 installer had a bug, that it considered 10.10 smaller than 10.7.3, the minimum requirement. This was probably a because the installer didn’t use natural ordering when compared the version strings. Click here if you want to read how could you fix it back then.

Now you have JDK 6, 7 and 8, but you might want to choose which one to use. You can set this with the $JAVA_HOME environment variable, which you can export in your .bash_profile. I found a really nice tutorial which tells, that above Mac OS X 10.5 you can use /usr/libexec/java_home to determine your java version home. Without arguments it would return the default, but for example with /usr/libexec/java_home -v 1.7 it will give you the Java 7 home.

So for using Java 7 just add

export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)

to your .bash_profile and you’re good to go.


  1. Chris Muse
    Chris Muse January 10, 2016

    Thank you for a clear, concise, comprehensible, functional fix !!!

  2. zaphodb
    zaphodb May 24, 2016

    Thanks, nice simple explanation, a big help!

Leave a Reply

%d bloggers like this: