Oracle’s JRE 8 on Mac OS X El Capitan

El Capitan has been released, and because my previous Java post got a lot more traffic than I expected, I’ve decided to consolidate all the information from it and create a guide for installing just the JRE (Java Runtime Environment).

In case you want clearer instructions for the JDK, I have also created another post for installing the JDK if that’s what you require. Installing the JDK is actually simpler because Oracle includes an installer which does a few of the steps for you, so some people may actually prefer those instructions.

The instructions below should also work for future updates to the JRE, so no need to worry about having to find and update version numbers in the code for an update this time!

  1. Go to the Oracle Java downloads page and download the JRE .tar.gz version. This is important, because the .dmg installer does not work as you might expect. You should end up with a file named something similar to jre-8u60-macosx-x64.tar.gz, but perhaps a newer version.
  2. Open Terminal
  3. Go to your Downloads folder and unzip the JRE download:
    cd ~/Downloads
    tar -xzf `ls -1 jre-8u*-macosx-x64.tar.gz | sort -rn -t u -k 2 | head -1`
    cd `ls -1d jre1.8.*.jre/ | sort -rn -t _  -k 1.8 -k 2 | head -1`
    

    If this failed for some reason, you can alternatively open the downloaded .tar.gz file from Finder then navigate to the unzipped directory in Terminal and continue.

  4. Edit the Info.plist file within to enable the JRE to be used from the the command line, and from bundled applications:
    defaults write "`pwd`/Contents/Info.plist" JavaVM -dict-add 'JVMCapabilities' '<array><string>JNI</string><string>BundledApp</string><string>CommandLine</string></array>'
    chmod 0664 Contents/Info.plist
    plutil -convert xml1 Contents/Info.plist
    

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

  5. Move the JRE folder to the correct location:
    sudo mv "`pwd`" /Library/Java/JavaVirtualMachines/
    

    Your password is required here because it is outside of your user folder. Be sure you are in the correct directory (the JRE folder) when you issue this command, because it will move your current directory to /Library/Java/JavaVirtualMachines/!

  6. Create a link to add backwards compatibility for some applications made for older Java versions:
    mkdir -p Contents/Home/bundle/Libraries
    cd Contents/Home/bundle/Libraries
    ln -s ../../lib/server/libjvm.dylib libserver.dylib
    

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

Oliver

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

64 thoughts on “Oracle’s JRE 8 on Mac OS X El Capitan”

    1. That is a very old version of Java. It is not maintained. It has security vulnerabilities. It is lacking many features added in Java 7 and Java 8. Apple does not intend to keep releasing it for future OS X versions. On the page you linked, Apple even suggests using Java from elsewhere.

      From the link:

      This package is exclusively intended for support of legacy software and installs the same deprecated version of Java 6 included in the 2014-001 and 2013-005 releases.

      Keep your software up to date. If you need Java, download the latest version of Java for OS X directly from Oracle https://www.java.com

  1. Something went seriously wrong. When prompted for my password, I was not able to type it in. Now, when I try to open ANY application (Chrome, Photoshop, iMessages), they won’t open. For example, when I try to open Chrome, it says “Google Chrome cannot read and write to its data directory.” What did I do?!?!?! And how do I fix it?!?!?!?!

    1. I’m guessing you did step 6 incorrectly.

      Your password is required here because it is outside of your user folder. Be sure you are in the correct directory (the JRE folder) when you issue this command, because it will move your current directory to /Library/Java/JavaVirtualMachines/!

      Check the contents of /Library/Java/JavaVirtualMachines, and if it contains a folder that is not named after the JRE (e.g. jre1.8.0_60.jre) then you have moved the wrong folder. If, for example, you moved your whole user directory to this location, you will need to move it back with something like sudo mv /Library/Java/JavaVirtualMachines/myusername /Users/ (or move it using Finder if it lets you).

  2. Yes thanks so much – this was very helpful!

    To any novices I’d recommend you copy and paste these lines to the terminal so you don’t make mistakes – I didn’t realize that line 1 in step 4 was so long until I did that.

    1. hey eric, I am one of those novices you refer to… are you available to fix this for me via remote? happy to pay for your time… I am desperate to get by CS5.5 working… I upgraded to el capitan… I can’t reverse this process as I need the current operating system for other software.

      1. Hi Cassandra, in the message you sent me via my contact form, you didn’t seem to know what Terminal refers to. It is a default application for Mac OS X, which is located at /Applications/Utilities/Terminal.app (“Utilities” folder in the “Applications” folder).

        However, you also mentioned that you installed the JDK, which is different to the JRE. The page you commented on is for the JRE, so check out my other post with instructions for the JDK.

        Note that these posts are about getting Oracle’s Java installed, not getting Adobe CS5.5 working with El Capitan. If you don’t care what Java you have installed, the easiest solution for novices is to just install the legacy Java 6 runtime for OS X 10.11 El Capitan from Apple.

        Instead of offering to pay someone to get Adobe CS5.5 working, I think your money would be better spent upgrading to a newer version of Adobe’s Creative Suite/Cloud.

        1. Thank you Oliver, I did try to install Java 6 runtime and still could not get CS5 (photoshop) to open, kept crashing before fully opened. I also need to maintain current version of JAVA for other applications I use for my work. I did locate the Terminal app and opened it, but then did not understand what to do with it. As for the JDK vs JRE, not sure which I should be doing, hence my query as to your availability to ‘do it for me’? SO, couple of key things I need, 1) to maintain current version of Java and 2) get current CS5 working (don’t want to move to the Adobe cloud software for a variety of reasons). Perhaps you could recommend someone who could do this for me via remote? I very much appreciate all the work you are doing.

  3. I’d like to leave Java out of my Mac completely, but I need it for two reasons: a) internet banking, and b) Adobe Apps (which apparently rely on Java 6). I figured this method might help me install only the latest Java JRE. Indeed, it seems I can at least run Adobe apps now, but Safari apparently is not detecting Java. Doesn’t your method install the web plugin as well? If so, what will happen if I install the dmg afterwards?

    1. I believe only the older Adobe apps require Java to be installed by the user. I think the apps are now native, but they could come bundled with Java, I haven’t looked into it.

      I have only documented getting apps to work, and I don’t think the JRE option in this blog post comes with the internet plugins you’re wanting. You will probably have to download the dmg version on Oracle’s download page, which comes with an installer that installs (among other things) the plugin/s that you will need. For a minimal install, you might be able to extract just the plugin, and install it to /Library/Internet Plug-Ins/JavaAppletPlugin.plugin, and possibly also the System Preferences pane to /Library/PreferencePanes/JavaControlPanel.prefpane.

      1. Thanks, I installed the plugins and now both Adobe apps (CS5 wouldn’t run without Java 6, Apple provides a package with it, but it is unsupported and even a bigger mess than up to date Java, security wise) and internet banking are working. Also, I just remembered I will need Java when doing taxes next year. I avoided installing Java 6, which was my main goal. You’ve been very helpful, congratulations on the good work!

  4. This worked great, and as a result I can now run ImageJ. Thank you! Before I found your article, I installed the .dmg (the one that “does not work as you might expect”). Any idea where the .dmg dumped its files, so that I may delete them?

    1. On Oracle’s website, there is a “How do I uninstall Java on my Mac?” page, that says to remove /Library/Internet Plug-Ins/JavaAppletPlugin.plugin and /Library/PreferencePanes/JavaControlPanel.prefpane. You can do this in Terminal with:

      sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin 
      sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefpane
      
  5. Hi Oliver,

    I came to your page because Oracle .dmg installer kept crashing on me (right after the “do you want to install Yahoo?” screen). I followed your instructions and JRE 8 seems to have installed just fine. Typing “java -version” at the prompt returns

    java version “1.8.0_66”
    Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
    Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

    However, the Java Control Panel does not seem aware that Java has been updated. You alluded to this in another post on the .dmg installer. Since I can’t seem to run the .dmg installer, do you have any suggestions on how to get the Java Control Panel to recognize the udpated version of Java?

    Thanks,
    Dave Tanner

    1. First, try the automatic update in the Java Control Panel. If that doesn’t work, double check that you have the latest Java .dmg installer, update 66. The Java.com download page is more user-friendly than the other linked page in my post, but only provides the .dmg installer. I was under the impression that update 66 did not include the Yahoo? screen, like update 65, but I did not test, and could be mistaken. Note, however, that this is for Java on the web. If that still doesn’t work, you could try uninstalling Java, and running the installer again.

      The Java .dmg installer provides an internet plug-in that actually has its own JRE inside it. This means that it does not reference the JRE installed if you followed my instructions. This is good for people wanting to use Java in the browser, because it has easily accessible settings, and should be able to automatically update, but it makes it difficult for people wanting to use Java for other purposes. This is intentional by Oracle, they do not want applications to use the JRE in this way. In my opinion, Oracle should make this more clear, but it is mentioned on one of their help pages.

      The Java Internet Plug-In is installed in /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/ and, as the name suggests, is clearly intended for Web Applets. It may be possible to create a link to that in /Library/Java/JavaVirtualMachines/, but I have not tested this, and probably wouldn’t recommend it. I don’t know enough about it to say that this wouldn’t be a security risk, for example, allowing Applets to do things they shouldn’t be allowed to do.

  6. Thank you, Oliver. I’ve had partial success, and I don’t see my particular failure listed in the comments so far. I’m running El Capitan with all the updates through today, 2015.12.28. I followed your procedure, and was successful in launching Adobe Illustrator CS6 in my admin account. However, returning to my non-admin account, I again get the error message claiming that I need the legacy Java 6.

    Your procedure doesn’t look to reference a specific user, to my ignorant eye. Do you have any thoughts on a solution to my problem?

    1. Someone else mentioned this as well. This is a permissions issue, specifically for the Info.plist file. I have updated my blog post, but you should be able to fix this with the following command:

      chmod 0664 `ls -1rd /Library/Java/JavaVirtualMachines/jre* | head -1`/Contents/Info.plist

  7. Additional data, continuing my previous post: I downloaded the latest JRE version from the Oracle link you provided, 8u66. In my admin account, the Terminal command “java -version” executes, and returns the expected version number. In my standard account, the same command reports, “No Java runtime present, requesting install.”

    I apologize if this is all obvious to an experienced person. I’m not understanding what aspect of the procedure would affect one user account, and not another. From my standard account, I can see that the JRE folder is installed in /Library, rather than ~/Library, so my ignorant supposition is that it would be accessible to all users.

    1. Someone else mentioned this as well. This is a permissions issue, specifically for the Info.plist file. I have updated my blog post, but you should be able to fix this with the following command:

      chmod 0664 `ls -1rd /Library/Java/JavaVirtualMachines/jre* | head -1`/Contents/Info.plist

  8. Thanks Oliver, that worked nicely for me, and I can now run Information Workbench. It turns out that my Oxygen installation doesn’t like Java 8 though (it wants Java 6), which is irritating. However, I’m pleased that I could get this part working, and I’ll persevere with getting Oxygen in line. Thanks again.

  9. Oliver, I don’t want to count any chickens, but having followed your instructions, everything *seems* to be working fine. I will cross everything, and in the meantime, just offer my sincere thanks for solving a massive, massive problem. Hugely clear instructions…

  10. Thanks, this worked fine for my account.

    When I tried to run a java app (Minecraft) from another account on the same machine, it does not recognize that java is installed.

    I can see the /Library/Java/JavaVirtualMachines/ folder from the other account ?

    Perhaps some sort of permission issue ?

    1. Someone else mentioned this as well. This is indeed a permissions issue, specifically for the Info.plist file. I have updated my blog post, but you should be able to fix this with the following command:

      chmod 0664 `ls -1rd /Library/Java/JavaVirtualMachines/jre* | head -1`/Contents/Info.plist

  11. Hello.

    Thank you very much for your guide. I followed it to the letter, and the installation seems to have gone smoothly. However, I wanted to install JRE so that I can run a little .jar app. After following your guide, I try to run the .jar app, but the extension does not seem to be associated with Java because it opens my default program for compressed files. How can I run that .jar app?

    Thanks in advance.

    1. You will have to right click on the .jar file and then select Open With > Jar Launcher. If you want to apply that to all jar files, you will have to Get Info > Open With > Jar Launcher > Change All....

      1. Thank you for replying so quickly. I’m sorry I didn’t mention this on my previous post, but there were no Java related apps to open the .jar with when right-clicking on it. There isn’t any pane for Java in System Preferences either. That’s why I couldn’t launch the .jar app.

        Since you mentioned Jar Launcher, I googled it and found it it’s located here (in case anyone else might find it useful):
        /System/Library/CoreServices/Jar Launcher.app

        Double-clicking it once was enough so that my .jar app would automatically be associated with it.

        Thanks again.

  12. I don’t see a tar.gz version of this at the link provided. Only the .dmg version
    Mac OS X 227.35 MB jdk-8u102-macosx-x64.dmg
    Am I missing something or has something changed?

      1. Good morning Oliver.
        What version of Java do i have download? JRE 8u101 or JRE 8u102?
        Thanks in advance.
        Monsanto

              1. You do not need to install the dmg as well. There is no application. Some applications require a JRE to function. If you followed the instructions, you will be able to run Java based applications.

  13. Great article. Stumbled on it trying to get elasticsearch to work. I had filed a bug with the es developers, but then found this and cited it in my resolution message, so you might get another traffic spike… sorry 😉 *bookmarking*

  14. Lifesaver, thanks a lot.
    I had a problem as a beginner on step 5 and 6 , it never said that i have to move to ‘/Library/Java/JavaVirtualMachines/jre1.8.0_121.jre’ before i can execute step 6.
    But after trial and error i manage to make it work
    Hope this will help for other beginner like me

    Thanks again Oliver

    1. Hi Denny,

      Step 5 moves the folder you’re in, so you should be in /Library/Java/JavaVirtualMachines/jre1.8.0_121.jre at the end of step 5, however, Terminal does not update what it is displaying for the current path, so I can see the confusion. Did it not work when you tried to do step 6, or did you change to that directory before continuing?

      Oliver.

      1. Hi Oliver,
        I did change to that directory before continuing.
        Btw, I’m trying react native to build android apps and i just realized that i need to install JDK to make it work. So now i’m going to download the JDK and follow your other blog regarding installing the JDK.

        Can i just leave the jre to where it is now ? or should i uninstall it by reverting the steps above ?

        Thanks

    1. I didn’t link directly to that download page because I was unsure if it linked to a specific version, or if that page gets updated whenever Oracle releases a new version. That link takes me to the current version, Java SE Runtime Environment 8u131. I will try and check back after there is another update, and add the link to my post if it still links to the latest version at the time. Thanks!

  15. Hope you can help. I’ve successfully installed JRE on my laptop. Having problems for some reason on the desktop. After navigating to the unzipped folder in downloads and typing the first line in part four (that edits the info.plist file) I get the following note:
    2017-08-23 16:35:53.549 defaults[10931:3002438] Unexpected argument -dict-add; leaving defaults unchanged.
    I copied and pasted the line perfectly. Any help is appreciated.

    1. I’m guessing that maybe your path contains a space. Can you try putting double quotes (") around the command, and see if that works? It should look something like this:

      defaults write "`pwd`/Contents/Info.plist" JavaVM -dict-add 'JVMCapabilities' 'JNIBundledAppCommandLine'

  16. Thank you so much!!! I recently updated my macbook to a SSD with the newest OS and just installed all of my old adobe programs and none of them would open! I tried the link it takes me to on apple but it just kept saying 404 error when I tried to download it…. after searching and searching I found this (Actually the older article….this one is much easier to follow) and this worked perfectly!!

  17. I’m having the same problem where Im trying to open Lightroom and it says I need Java 6 runtime. I’ve tried uninstalling old versions but continue to get the message that a newer version is still installed on the disk so it won’t let me do the old version. I tried your fix but because i don’t know coding I think I’m copying and pasting old information. I downloaded this file from oracle jre-9.0.1_osx-x64_bin.tar. I’m going crazy trying to make this work and hoping maybe I’ve found someone who can help.

    1. I have not tested with JRE 9, but to install it, you will have to change the file names in Step 3. I cannot attest as to whether or not this works with Lightroom. You could also try installing the latest version of JRE 8, which can still be downloaded from the same webpage as JRE 9.

Leave a Reply