Java is no longer installed with a OS X 10.11 El Capitan clean install, and you’ll find that after updating a Mac a prior version of JRE may no longer function.
You may come across when trying to use some particular applications or web content, “This application requires the legacy Java SE 6 runtime which is unavailable for this version of OS X.” error message, which means if you want to run that app you’re going to need to use an older version of Java.
If you do not need Java, you should not install Java. Java is, and always has been, the source of many security holes.
Here’s how you can install JRE (Java Runtime Environment).
Step 1. Open Safari and go to the Oracle Java downloads page and download the JRE .tar.gz version. You should end up with a file named something similar to jre-8u65-macosx-x64.tar.gz.
Step 2. Go to your Downloads folder and extract the JRE download or use Terminal to extract files:
tar -xzf `ls -1r jre-*-macosx-x64.tar.gz | head -1`
Step 3. Open Terminal
cd `ls -1rd jre*/ | head -1`
Step 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>'
plutil -convert xml1 Contents/Info.plist
Step 5. Move the JRE folder to the correct location:
sudo mv `pwd` /Library/Java/JavaVirtualMachines/
Type password on prompt.
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/!
Step 6. Create a link to add backwards compatibility for some applications made for older Java versions:
mkdir -p 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.
Step 2. Trick some applications into thinking that 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
Step 3. Don’t forget to enable SIP again after creating these directories.