Installing JDK on macOS M1 (Apple Silicon)
Follow these steps to install the Java Development Kit (JDK) on a Mac with an M1 chip (Apple Silicon), based on Oracle’s official instructions.
Step 1: Download the JDK
- Visit Oracle’s official JDK download page.
- Select the macOS ARM 64 (AArch64) version, designed for M1/M2 chips. The file should be named like
jdk-XX_macos-aarch64_bin.dmg(where XX is the version number).
- Click on the link and the download should start.
Step 2: Install the JDK
- Locate the
.dmgfile in your Downloads folder. - Double-click the
.dmgfile to open it. A Finder window will appear with a.pkginstaller.
- Double-click the
.pkgfile to start the installation.
- Follow the installation prompts, clicking Continue where necessary.
- When prompted, click Install and enter your admin password to allow the installation.

After successful installation, you should get the following screen.

Close the window.
Step 3: Verify the Installation
Once the installation is complete, you can verify it by following these steps:
- Open the Terminal application.
- Run the following command to check the installed JDK version:
java -version - If everything is installed correctly, the terminal will display the version of Java you installed.

Step 4: Set JAVA_HOME (Optional)
If you need to set the JAVA_HOME environment variable for development purposes, you can follow these steps:
- Open your
~/.zshrcor~/.bash_profilefile in a text editor. - Add the following line to the file:
export JAVA_HOME=$(/usr/libexec/java_home) - Save the file and run the following command in Terminal to apply the changes:
orsource ~/.zshrcsource ~/.bash_profile
Step 5: Uninstalling the JDK (If Needed)
- Open Terminal.
- Run the following command to remove the JDK installation:
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-XX.jdk - Replace
XXwith the version number you want to uninstall (e.g.,jdk-21.jdk).
For more details, refer to the official Oracle documentation here.
