This page answers frequently asked questions about the JDK and JRE for macOS computers.
The page has these topics:
"How do I find out which version of Java is the system default?"
"Can I restore Apple Java 6 after uninstalling Oracle Java 7?"
"What happened to the Java Preferences app in Application -> Utilities?"
"I have Oracle's version of the JRE installed, but it is not listed in Java Preferences"
See JDK 8 and JRE 8 Installation Start Here for general information about installing JDK 8 and JRE 8.
If you plan to run Java applications, install the Java Runtime Environment (JRE). The JRE is also referred to as Oracle Java. Once you have installed the JRE, you can launch Java applets and applications by double-clicking JAR files, JNLP files, and via the browser. Note that 32-bit browsers, such as Firefox in 32-bit mode, and Chrome, are not supported by the JRE.
If you plan to write Java applications, install the Java Development Kit (JDK).
The JavaFX SDK and Runtime are included in the installation of the JDK and JRE respectively, and they are integrated into the same directory structure. For information on how to work with JavaFX, see http://docs.oracle.com/javase/8/javase-clienttechnologies.htm
.
A: If you have not yet installed Apple's Java macOS 2012-006 update, then you are still using a version of Apple Java 6 that includes the plug-in and the Java Preferences app. See "Note for Users of macOS that Include Apple Java 6 Plug-in".
When you launch a Java application by clicking a JNLP file, or through the browser, it uses the installed JRE. Only one JRE can be installed. For more information, see "Determining the Installed Version of the JRE".
When you run a Java application from the command line, it uses the default JDK. If you do not develop Java applications, you do not need to worry about this. For more information, see "Determining the Default Version of the JDK".
A: Follow these steps:
From System Preferences, launch the Java Control Panel by clicking the Java icon in the Other section.
From the Java Control Panel, click Settings in the Temporary Internet Files section of the General tab.
In the Temporary Files Settings window, click Delete File.
From the Delete Files and Applications dialog, select Cached Applications and Applets and click OK to clear those files from the cache.
To clear the applet and Web Start cache from a Terminal window, use the following command (note escaped space character):
% rm -rf ~/Library/Application\ Support/Oracle/Java/Deployment/cache
Every time you launch a Java applet or a Java Web Start application, the system first launches your program and then, in the background (so that performance of your Java application is not impacted), it determines if it has checked in the last 7 days for a Java update.
If an update is available, a Software Update window appears.
Select Install Update which displays a Downloading update progress bar.
After the download has completed, a window pops up, asking if you want to install and relaunch. Once the update is installed, the application will be relaunched. You might want to finish your work before clicking Install and Relaunch.
At the end of the installation process, the installer notifies you if Java content is disabled in web browsers, and provides instructions for enabling it. If you previously chose to hide some of the security prompts for applets and Java Web Start applications, the installer provides an option for restoring the prompts. After the update is installed, the application is relaunched. If viewing an applet, the browser is relaunched.
Note that, if the application or applet does not automatically relaunch, be sure to manually relaunch so you can take advantage of the latest JRE.
If you choose Skip This Version, but later decide to check for an update, you can launch the Java Control Panel by clicking the Java icon in System Preferences. Go to the Update tab to initiate an update check.
If you choose Remind Me Later, you will be reminded of the update the next time you run Java.
Depending on your installation, see the related link:
The Java for macOS 2012-006 update from Apple uninstalls the Apple-provided Java applet plug-in from all web browsers. You can download the latest version of Java from http://www.oracle.com/technetwork/java/javase/downloads/index.html
, which has improved security, reliability and compatibility.
If you prefer to continue using Apple's Java 6 plug-in, you can follow the steps provided in http://support.apple.com/kb/HT5559?viewlocale=en_US&locale=en_US
If you want to continue to develop with Java 6 in a Terminal window you can modify the startup script for your favorite command environment. For bash, use this:
$ export JAVA_HOME=`/usr/libexec/java_home -v 1.6`
Some applications use /usr/bin/java
to invoke Java. After installing Java for macOS 2012-006, /usr/bin/java
will find the newest JDK installed, and will use that for all of the Java related command line tools in /usr/bin
. You may need to modify those applications to find Java 6, or contact the developer for a newer version of the application.
Go back to Apple Java 6 using the following instructions:
Uninstall Oracle Java 7 by deleting the plug-in file. From a Terminal window enter:
% sudo rm -rf /Library/Internet Plug-Ins/JavaAppletPlugin.plugin
Create a symlink using the following command, entered on a single line:
% sudo ln -s /System/Library/Java/Support/CoreDeploy.bundle/Contents/JavaAppletPlugin
Gatekeeper, introduced in Mountain Lion (macOS 10.8), is designed to prevent potentially malicious apps from launching. When you attempt to launch an app that doesn't meet certain criteria, Gatekeeper will block the launch. To override this, you can modify Gatekeeper's default settings, or explicitly right/control-click the application and choose Open.
To create a Java application that will launch without interruption under the default Gatekeeper settings, the app must be bundled with a JRE, use Oracle's launcher stub, and be signed with an Apple Developer ID. For more information on creating an app that satisfies these requirements, see Packaging a Java App for Distribution on macOS:
http://docs.oracle.com/javase/8/docs/technotes/guides/deploy/package_for_mac.html
The Java Preferences app was part of Apple Java installation and is not used by Oracle Java. Therefore, macOS releases from Apple that do not include Apple Java will not include Java Preferences.
One of the functions of Java Preferences was to set the current version of the JRE. Under Oracle Java, only a single version of the JRE can be installed at a time. For more information, see JRE 8 Installation for macOS.
To access the Java Control Panel, click the Java icon in the System Preferences panel. If the Java icon is not present (under the Other category) in System Preferences, you do not have an Oracle JRE installed.
This is correct. The JRE will not show up in the Java Preferences list unless you install the full JDK.
Installing a JRE from Oracle does not update java -version
symlinks or add the java
command to your path. For this functionality, you must install the full JDK.