The following are the system requirements for installing the JDK and the JRE on macOS:
Any Intel-based computer running macOS.
Administrator privileges.
You cannot install Java for a single user. Installing the JDK and JRE on macOS is performed on a systemwide basis for all users. Administrator privileges are required to install the JDK and JRE on macOS.
When you install the JDK, it also installs the JRE. However, the system will not replace the current JRE with a lower version.
To determine the current JRE version installed on your system, see Determining the JRE Version Installed on macOS. To install an earlier version of the JRE, you must first uninstall the current version. See Uninstalling the JRE on macOS.
When you install the JRE, you can install only one JRE on your system at a time. The system will not install a JRE that has an earlier version than the current version.
To determine the current JRE version installed on your system, see Determining the JRE Version Installed on macOS. To install an earlier version of the JRE, you must first uninstall the current version. See Uninstalling the JRE on macOS.
Note:
Installing a JRE from Oracle will not update java -version
symlinks or add java
to your path. To do this, you must install the JDK.
In this post you will learn how to set the default JAVA_HOME
in OS X when you have more than one JDK installed in your computer. First you need to run /usr/libexec/java_home -V
command to get the list of installed JDK. The command will print out something like the following depending on the available JDK in your computer.
On my machine I have the following version of Java.
From the list above pick which version you want to be the default JDK. For example I will choose the 1.8.0_121
version to be my default JDK. To set it run the command below.
If the major version of the available JDK is unique you can just use the major version, like:
After setting the JAVA_HOME and you run the java -version
command you will see that JDK 1.8 is the new default JDK in your computer.
The change above will only active in the current running shell. If you close or terminate the shell, next time you open the shell you will need to set it again. To make this change permanent you need to set it in your shell init file. For example if you are using bash
then you can set the command in the .bash_profile
. Add the following lines at the end of the file.
Even before that, the new Java Plug-In already supports launching applets in a 64-bit JVM from a 32-bit browser on Mac OS X. Beyond the core support for Mac OS X, the following changes were made: - Bugs were fixed in com.sun.deploy.cache.CacheEntry, com.sun.deploy.config.Config, and com.sun.deploy.util.SyncFileAccess related to network-mounted.
To activate this configuration right away your can run source .bash_profile
. This command reads and executes the .bash_profile
in the current shell.