Oracle’s JDK 8 on Mac OS X El Capitan

My previous post about installing Java on OS X received quite a bit of traffic, and I felt that some of the information was outdated, and it became a little unclear after all the edits, so I’ve endeavoured to create a much easier to understand set of instructions.

The instructions for installing the JDK (Java Development Kit) are a subset of the instructions for installing just the JRE, because Oracle provides an installer for the JDK.

  1. Go to the Oracle Java downloads page and download the JDK installer. You should end up with a file named something similar to jdk-8u60-macosx-x64.dmg, but perhaps a newer version.
  2. Open the .dmg Disk Image and run the installer.
  3. Open Terminal
  4. Edit the JDK’s newly installed Info.plist file to enable the included JRE to be used from the the command line, and from bundled applications:
    cd `ls -1d /Library/Java/JavaVirtualMachines/jdk1.8.*.jdk | sort -rn -t _ -k 1.42 -k 2 | head -1`
    sudo defaults write "`pwd`/Contents/Info.plist" JavaVM -dict-add 'JVMCapabilities' '<array><string>JNI</string><string>BundledApp</string><string>CommandLine</string></array>'
    sudo chmod 0664 Contents/Info.plist
    sudo plutil -convert xml1 Contents/Info.plist

    The third line fixes a permissions issue create by using defaults write. The fourth line is not required, but makes the file more user-friendly if you open it again in a text editor.

  5. Create a link to add backwards compatibility for some applications made for older Java versions:
    sudo mkdir -p Contents/Home/bundle/Libraries
    cd Contents/Home/bundle/Libraries
    sudo ln -s ../../jre/lib/server/libjvm.dylib libserver.dylib
  6. Optional: If you’re actually using the JDK for software development, you may want to set the JAVA_HOME environment variable. The recommended way is to use /usr/libexec/java_home program, so I recommend setting JAVA_HOME in your .bash_profile like Jared suggests:
    echo "export JAVA_HOME=\`/usr/libexec/java_home\`" >> ~/.bash_profile
    chmod u+x ~/.bash_profile

    This will get the latest installed Java’s home directory by default, but check out man java_home for ways to easily get other Java home directories.

You should be done now, so try and open the application. If it does not work, some applications require legacy Java 6 to be installed. You can have it installed without actually using it, however, it’s possible to trick the applications into thinking legacy Java 6 is installed, without actually doing so.

If you’re running El Capitan, this is actually a little difficult now, because Apple added SIP (System Integrity Protection) to OS X. I have written a post explaining how to disable and enable SIP.

If you’ve disabled SIP, or are not running El Capitan yet, you can trick some applications into thinking legacy Java 6 is installed by creating two folders with the following commands in Terminal:

sudo mkdir -p /System/Library/Java/JavaVirtualMachines/1.6.0.jdk
sudo mkdir -p /System/Library/Java/Support/Deploy.bundle

Don’t forget to enable SIP again after creating these directories.

Published by


I am a web developer, I am a software developer.

18 thoughts on “Oracle’s JDK 8 on Mac OS X El Capitan”

  1. Hi Oliver. Any idea whether the new Jave update (Version 8 Update 65) is a problem for Adobe CS users running El Capitan? I ran into issues when I installed the new OS but remedied them with some help from your post here and other forums. Now I am cautious of whether the new Java update with be a safe install if I want to keep using CS3 or CS4. Thanks for your help.

    1. Hi Jeff. I do not run Adobe CS, so I can’t say for sure. If you’re updating from another version of Java 8, then I think it’s unlikely you will run into issues.

      Note that if you install the new Java update (Version 8 Update 66 is the latest) following the instructions on my blog post, the previous Java version is not removed or overwritten. If you run into issues, you can simply remove the folder where the update was installed, and OS X should automatically start using the previous Java version.

    1. I think the recommended way to ship Java applications is to bundle the JRE with the application. The JDK is intended for application developers, so it doesn’t make sense to automatically add the ability to launch Java applications when you install it for development. There are many applications that use Java unbeknownst to the user because it is bundled in the application, and does not require the user to install Java on their computer. There are positives and negatives to this, but I won’t get into that.

      The part where I create links is because some older apps referenced a Java library file at a specific location, which was fine for older versions, but was not the “proper” way of doing it. When the specific path to the library changed, some older apps stopped working. Some apps that referenced Java “properly” still work without doing this step. Oracle increments the version number when there are potentially application-breaking changes. There is no guarantee that apps that run on Java 6 will run on Java 7, let alone Java 8. It is up to the application developer to update their code if they wish to use the latest version of Java. It may have been nice of Oracle to add those links, to increase backwards compatibility, but it is not their responsibility, and in my opinion, should not be including them.

      Step 6 is user preference, and not something that should be done by the Java installer.

      The reason for the last note is essentially “tricking” some apps into using the installed Java (version 8 in my blog post) when they are trying to use Java 6. The apps are saying “I need Java 6 to work, because I can’t guarantee that I will work with newer versions of Java, so please install Java 6.” The Java installer should not be doing this at all, nor should it even be touching the System directory.

      TL;DR: The issue is not with the Java installer, in my opinion.

        1. My instructions do not say to run an installer, and I don’t know what the error is, so I don’t know if there is a fix or not.

  2. Thanks for the excellent posting on installing the JDK onto a mac. I am totally new to the mac environment and this posting really helped. I tried to follow the other posting for the JRE but ended up not being able to use it for apps like LibreOffice. But the idk post worked like a champ.
    Again Thanks

  3. Oliver, thank you for your help with this. I have a question. If I do not need to use Java on my iMac, but have issues with Photoshop saying that it needs Legacy Java 6, and will not start in El Capitan, can I do to Step 6 of your instructions directly without doing Steps 1-5? Would that possibly work?

  4. ls -1rd /Library/Java/JavaVirtualMachines/jdk*.jdk | head -1 is NOT listing recent version first.
    for e.g.

    It should pick up the jdk1.8.0_101.jdk not the *_20 jdk.
    Kindly alter it please.
    NICE blog

    1. Thanks for pointing that out, I had only tested with two-digit update numbers (and JDK 8). I have updated the line to:

      ls -1d /Library/Java/JavaVirtualMachines/jdk1.8.*.jdk | sort -rn -t _ -k 1.42 -k 2 | head -1

  5. Just wanted to say thanks for this! Was very helpful in getting some old java apps running on 8 instead of 6.

  6. Your instructions are a saving grace… especially since the information is NOWHERE else to be found online.

    Maybe, though, you can also help me with one other issue. I’ve posted it to so many forums Java, Eclipse, etc.
    ( )

    Basically… there’s this Java App… on MY user account it uses Lucida Grande. If I create a test user on my computer… it uses the correct SF System font (macOS Sierra). Any ideas or pointers?

    1. Glad my post helped.

      Your other issue sounds like there might be a configuration file somewhere in your home directory, but unfortunately I don’t think I can be of any more help than that.

      1. Thx for your answer, Oliver.

        Something like this I thought too. It is really weird. Since I am not a Java/Eclipse dev I thought there might be an obvious answer. I went rampage and tried to delete everything that I could find that seemed like a related config file.

        Anyhow. Thx again… and have a nice Easter holiday!

Leave a Reply