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

 About This Book

 JVM (Java Virtual Machine) Specification

Java HotSpot VM - JVM by Oracle/Sun

 What Is HotSpot JVM

Download and Install JDK on macOS

 Download and Install Latest JDK on Windows

 Running Java HotSpot Client VM

 Running Java HotSpot Server VM

 HotSpot Memory Usages on Windows Systems

 java.lang.Runtime Class - The JVM Instance

 java.lang.System Class - The Operating System

 ClassLoader Class - Class Loaders

 Class Class - Class Reflections

 JVM Runtime Data Areas

 JVM Stack, Frame and Stack Overflow

 Thread Testing Program and Result

 CPU Impact of Multi-Thread Applications

 I/O Impact of Multi-Thread Applications

 CDS (Class Data Sharing)

 Micro Benchmark Runner and JVM Options

 Micro Benchmark Tests on "int" Operations

 Micro Benchmark Tests on "long" Operations

 Micro Benchmark Tests in JIT Compilation Mode

 Micro Benchmark Tests on "float" and "double" Operations

 OpenJ9 by Eclipse Foundation

 JRockit JVM 28.2.7 by Oracle Corporation

 Outdated Tutorials

 References

 Full Version in PDF/EPUB