Java

There is no AI here. All content is human-authored and tested for accuracy.

Install Java on Mac

How to install Java on Mac. Get a recommended JDK, use the installer, and verify Java on macOS. Which JDK to use. How to avoid common setup and version problems.

Apple used to bundle Java with macOS, but stopped in 2012. Now you need to install Java yourself. This guide walks you through installing Java on your Mac using the manual installer method. With this article, the entire process takes about five minutes. If you've heard that Java installation is difficult, it's only because the choice of vendors, versions, and installation methods can be confusing without the guidance that's offered here.

Before you get started

You'll need a terminal application to install Java on your Mac. Apple includes the Mac terminal but I prefer Warp Terminal. Warp is an easy-to-use terminal application, with AI assistance to help you learn and remember terminal commands. Download Warp Terminal now; it's FREE and makes coding easier when working with Java.

Homebrew or Manual Installation

If you're not sure whether Java is already on your Mac, see Check Java Version on Mac.

You have two ways to install Java on macOS.

Homebrew is faster for most users. One command downloads and installs Java automatically. If you already use Homebrew for developer tools, this is the easier path. For Homebrew installation, read next: Brew Install Java - Easy Cask Method

Manual installation is an alternative if you don't want to use Homebrew. This guide covers the manual approach. You download the installer directly from the vendor website, double-click to install, follow the wizard, and enter your admin password. This method works well for users who prefer a graphical installer or do not use Homebrew. Start with the article Download Java for Mac.

What's Covered Here

This guide covers manual installation using the .pkg installer. Here's what you'll find:

  • Java vendor and version — Why we recommend Java 25 and Eclipse Temurin
  • Download the installer — Get the correct .pkg file for your Mac
  • Run the installer — Step-by-step wizard walkthrough
  • Verify the installation — Confirm Java works with java -version
  • Configure JAVA_HOME — Optional setup for build tools
  • Troubleshooting — Quick fixes for common problems

Java Vendor and Version

This guide recommends Java 25, the current LTS (Long-Term Support) version released in September 2025. Read Java Latest Version for details about what's new in Java 25 and Compare Java 21 to Java 25. LTS versions receive security updates and bug fixes for years, making them the stable choice for most projects. Java 25 has support until 2033.

Java 25 is your best choice for new projects. Alternatively, you can Install Java 21 if your project or university course requires the older version.

This guide recommends Eclipse Temurin from Adoptium, the preferred Java distribution for most users. Temurin is free and open source with no licensing restrictions, built from OpenJDK source code, and maintained by the Eclipse Adoptium project with backing from IBM, Microsoft, Red Hat, and others. Read Install JDK on Mac for comparison of Oracle JDK, Amazon Corretto, Azul Zulu, and other distributions.

Download the Installer

Before running the installer, you need to download the correct .pkg file for your Mac.

Read Download Java for Mac for step-by-step download instructions before you continue here.

Our download instructions guide you to https://adoptium.net/temurin/releases. Get the correct download:

  1. Operating System: macOS
  2. Architecture: aarch64 (for Apple Silicon) or x64 (for Intel)
  3. Package Type: JDK
  4. Version: 25 - LTS
  5. PKG or DMG: - PKG

The .pkg file is the native macOS installer format. For most Java setups on macOS: choose the PKG for a clean, system‑wide install in /Library/Java/JavaVirtualMachines, discovered by java_home, IDEs, and tools. It provides a guided installation wizard and properly registers Java with your system.

After downloading, you will have a file in your Downloads folder with a name like OpenJDK25U-jdk_aarch64_mac_hotspot_25.0.1_8.pkg and you'll be ready to run the installer.

Run the Installer

The Java installer from https://adoptium.net/temurin/releases uses a standard macOS installation wizard. The process takes about two minutes.

Installation Wizard Steps

  1. Open the installer. Double-click the downloaded .pkg file in your Downloads folder. If macOS asks to confirm opening the file, click "Open."

  2. Introduction screen. The installer displays a welcome message explaining what will be installed. Click "Continue."

  3. License screen. Read the license agreement (GPLv2 with Classpath Exception for Temurin). Click "Continue," then click "Agree" to accept. You must accept the license to proceed.

  4. Installation Type screen. The installer shows the destination and disk space required (approximately 300 MB). The default location /Library/Java/JavaVirtualMachines/ is correct for macOS. Click "Install."

  5. Authentication prompt. Enter your administrator password when macOS asks. This is required because the JDK installs to /Library/Java/JavaVirtualMachines/, which is a protected system directory. The installer cannot proceed without your password. If it's your own Mac, the administrator password is the password you use to unlock your Mac.

  6. Installation progress. Wait while the installer copies files. A progress bar shows the installation status. This typically takes 30 seconds to 2 minutes depending on your Mac.

  7. Installation complete. The installer displays "The installation was successful." Click "Close."

  8. Clean up. You can move the .pkg file to Trash after installation completes. The installer is no longer needed.

Where Java Installs

The installer places the JDK in the standard macOS location for Java installations.You can view installed JDKs by listing the directory:

$ ls /Library/Java/JavaVirtualMachines/
temurin-25.jdk

Inside this bundle, the actual Java home directory is:

$ ls /Library/Java/JavaVirtualMachines/temurin-25.jdk/Contents/Home/
bin	conf	include	legal	lib	NOTICE	release

This Contents/Home path is required by tools that use the "JAVA_HOME" environment variable to locate the Java installation. It contains the bin folder with java, javac, and other executables. The installation is system-wide, meaning all user accounts on your Mac can access this Java installation.

Confirm the Installation

After installation, confirm Java works correctly. Open a new Terminal window to do so. Existing Terminal windows may not detect the new installation.

Check the Java Version

Learn How to Open Terminal in Mac and run:

$ java -version

Expected output (version numbers may vary):

$ java -version
openjdk version "25.0.1" 2025-10-21 LTS
OpenJDK Runtime Environment Temurin-25.0.1+8 (build 25.0.1+8-LTS)
OpenJDK 64-Bit Server VM Temurin-25.0.1+8 (build 25.0.1+8-LTS, mixed mode)

The output confirms three things: the version number (25.0.1), the distribution (Temurin), and that the 64-Bit Server VM is active.

Check the Compiler

Verify the Java compiler installed correctly:

$ javac -version
javac 25.0.1

List Installed JDKs

macOS provides a utility that finds all installed JDKs:

$ /usr/libexec/java_home -V
Matching Java Virtual Machines (1):
    25.0.1 (arm64) "Eclipse Adoptium" - "OpenJDK 25.0.1" /Library/Java/JavaVirtualMachines/temurin-25.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/temurin-25.jdk/Contents/Home

This utility lists each installed JDK with its version, architecture (arm64 for Apple Silicon, x86_64 for Intel), vendor, and installation path.

If all three commands produce the expected output, your Java installation is complete and working.

Read Check Java Version on Mac for detailed version output interpretation and troubleshooting version detection.

Configure JAVA_HOME

For most users, Java works immediately after installation with no environment configuration required. Apple's macOS automatically finds JDKs installed in the standard location. The java and javac commands work without any additional setup.

However, some build tools require the JAVA_HOME environment variable to be set explicitly. Apache Maven fails without it. Gradle, Android SDK, and various build tools also look for JAVA_HOME. If you see errors mentioning "JAVA_HOME is not set," you need to configure this variable.

If you only run Java applications or use an IDE like IntelliJ IDEA (which manages Java paths internally), you can skip this step entirely.

Read Set JAVA_HOME on Mac for complete configuration instructions.

Java PATH

After installing Java with an installer, you don't need to set the Mac $PATH.

On macOS, Java is handled differently from most other languages because macOS includes its own Java launcher at /usr/bin/java, which is a small program that locates and runs a JDK executable rather than being the JDK itself. When you run a JDK installer, it places a JDK bundle in the standard macOS Java location /Library/Java/JavaVirtualMachines/<something>.jdk/, with the actual runtime living inside Contents/Home of that bundle. The macOS Java launcher is preset to look in this standard directory, so when you type java in Terminal, the shell finds /usr/bin/java because /usr/bin is already on the default PATH, and the launcher then searches /Library/Java/JavaVirtualMachines for an installed JDK bundle and runs its java binary. Because the launcher is already installed, and the lookup logic lives in the launcher, and the launcher itself is already on PATH, you don’t need to add the JDK’s own bin directory to PATH just to make the java command work. Because Apple favors Java, all you need is a valid JDK bundle in the standard directory (or add a symlink if the JDK is installed somewhere else).

Troubleshooting

Most installations complete without issues. Here are quick fixes for common problems.

"java: command not found" after installation: Open a new Terminal window. Existing windows do not detect new installations. If the error persists, verify the JDK exists at /Library/Java/JavaVirtualMachines/ and check the article Fix "java: command not found".

Wrong Java version appears: Multiple JDKs are installed, and macOS selected a different one. Run /usr/libexec/java_home -V to list all versions. Set JAVA_HOME to use a specific version.

Installer will not open: Right-click the .pkg file and select "Open" from the context menu. If macOS still blocks it, go to System Settings → Privacy & Security and click "Open Anyway."

"No Java runtime present" keeps appearing: Verify the installation with java -version. Restart any applications that triggered the dialog.

What's Next

With Java installed, you are ready to run Java applications and start development.

Run Java Applications

You can now run .jar files from Terminal:

$ java -jar application.jar

Set Up Build Tools

Most Java projects use Maven or Gradle for building and dependency management. Install these tools next if you are doing development work. Both tools require JAVA_HOME to be configured.

Configure Your IDE

IDEs like IntelliJ IDEA, Eclipse, and VS Code detect installed JDKs automatically. Open your IDE's preferences to confirm it found your Java installation.

Work with Multiple Java Versions

If your work requires different Java versions for different projects, you can install additional versions. Each version installs to its own folder in /Library/Java/JavaVirtualMachines/. Version manager tools like jenv and SDKMAN make switching between versions simple. Read Java Version Managers for setting up jenv or SDKMAN to switch between Java versions.

My mac.install.guide is a trusted source of installation guides for professional developers. Take a look at the Mac Install Guide home page for tips and trends and see what to install next.