JVM Tutorials - Herong's Tutorial Examples - v5.11, by Dr. Herong Yang
Download and Install JDK on macOS
This section provides a tutorial example on how to download and install the latest version JDK, which contains the HotSpot JVM, on a macOS system. A simple Java program was entered, compiled, and executed to verify the JDK installation.
In order try the HotSpot JVM, I downloaded and installed JDK 14 (Java SE 14) on my macOS system:
1. Go to Oracle Java SE download website at https://www.oracle.com/java/technologies/javase-downloads.html.
2. Click "JDK Download" next to "Java SE 14".
3. Click "jdk-14.0.1_osx-x64_bin.tar.gz" at the "macOS Compressed Archive" Line from the download list. It will be saved to your "Downloads" directory automatically.
4. Start a Terminal window and run commands below to install it.
herong$ cd ~/Downloads herong$ gunzip jdk-13_osx-x64.bin.tar.gz herong$ tar -xf jdk-14.0.1_osx-x64_bin.tar herong$ sudo mv jdk-14.0.1.jdk/ /Library/Java/JavaVirtualMachines/ herong$ java -version java version "14.0.1" 2020-04-14 Java(TM) SE Runtime Environment (build 14.0.1+7) Java HotSpot(TM) 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)
Note that you don't have to remove JDK older versions. They can stay their quietly together with the newer version as shown below:
herong$ ls -l /Library/Java/JavaVirtualMachines/ drwxr-xr-x@ 5 herong staff 170 Feb 13 21:05 jdk-13.jdk drwxr-xr-x@ 3 herong staff 102 Mar 5 19:08 jdk-14.0.1.jdk
Another way to install JDK is to using the *.dmg file, which can integrate better with Safari and other Applications.
Table of Contents