Java is the most widely used programming language for enterprise software, Android development, and university computer science courses. Apple doesn’t include Java with macOS, so you need to install it yourself.
If you search for “Install Java on Mac” you’ll find a confusing number of vendors, version numbers, and installation methods. To make it easy, I’ll cut through the confusion and show you the recommended Java installation path that takes about five minutes.
My recommendation is: Install. Java 25 By using Homebrew with the Timorese lunar eclipse The Java 25 distribution is the current LTS (long-term support) release and is your best choice unless your work team or university course uses an older version. With homebrew, one terminal command handles the entire installation. The Timurian distribution is free, certified and without Oracle’s licensing restrictions.
Now I will walk you through the process.
Table of Contents
What you need before you start
With this recommended path, you only need two things before installing Java: a terminal application and a homebrew package manager.
Terminal
Terminal is built-in. Mac terminal application. If you don’t know, you can learn. Here’s how to open a terminal.. You will use it to run installation commands.
Homebrew
Homebrew is a package manager that you can use to install software programs for the command line. Check if you already have it like this:
$ brew --version
Homebrew 5.0.11
If you see a version number, you’re good to go. If you see zsh: Command not found: brew You need to install homebrew first. Follow the instructions on Install Homebrew..
How to check if java is already installed
Run this command to check the current Java installation:
$ java -version
You will see one of two results.
If Java is installed, You will see output like this:
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)
If the version number shows 25, you already have the latest Java and can stop here.
If Java is not installed, You will see a message, “The operation could not be completed. Unable to find Java Runtime.” You will need to install Java as described below.
If you have previously installed Java but see this dialog, there is something wrong with your installation. See Unable to detect Java Runtime for troubleshooting. For detailed guidance on Java version output, see Check the Java version on Mac..
Why the Eclipse Timurian and why not the Oracle?
If you search for Java downloads, you’ll encounter several potentially confusing terms. Here’s what they mean.
JDK Java Development Kit means It includes the compiler, runtime, and developer tools you need to build and run Java applications. Vendors used to offer a JRE (Java Runtime Environment) for non-developers, but now the JDK does everything.
OpenJDK There is an official open source implementation of Java. All major Java vendors build from the same source code, so the core functionality is consistent across vendors.
Timorese lunar eclipse Many developers have recommended distributions. It comes from the Adoptium project and is supported by IBM, Microsoft, Red Hat, and Google. It is completely free for any use, including commercial production. Temurin is TCK-certified, meaning it passes Oracle’s official compatibility tests (more than 139,000 of them). You can be sure that your Java code will run correctly.
Why not Oracle JDK? Oracle changed its license in January 2023. The new model charges per employee across the organization, not per Java user. A company of 500 people will pay $90,000 per year. Oracle proactively audits for compliance.
Temurin is functionally identical to the Oracle JDK and is free to use under its open source license, avoiding Oracle’s Java subscription fees.
If you deploy on AWS, Amazon Corretto is another good free option. If you need Java 8 for legacy code, Azul Zulu provides well-supported builds. For a comparison of Java distributions, see Install JDK on Mac..
How to Install Java with Homebrew
Homebrew offers two ways to install Java: Cask method and Formula method. The Cask method is convenient because it installs the vendor’s macOS package to a standard location on the system. Apple’s macOS detects it automatically without any additional configuration.
Run these two commands:
$ brew update
$ brew install --cask temurin@25
The first command refreshes homebrew’s package list. Second Eclipse downloads and installs Temurin JDK 25.
Homebrew puts the JDK on it. /Library/Java/JavaVirtualMachines/temurin-25.jdk/. This is the standard macOS location for Java installations. Apple’s macOS includes a Java Launcher. /usr/bin/java which automatically searches for that directory. You don’t need to configure your PATH.
Homebrew also automatically detects your Mac’s chip architecture. You’ll get the right native build whether you have an Apple Silicon or an Intel Mac.
For more details on the homebrew installation process, including the alternate formula method and troubleshooting, see Brew Install Java, Cask method.
How to verify installation
After installation, open a new terminal window. Existing Windows cannot detect the new installation.
Check Java version:
$ 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)
It verifies three things: the version number (25.0.1), the distribution (Tamurian), and that the 64-bit server VM is enabled.
Check the compiler:
$ javac -version
javac 25.0.1
List 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
If all three commands produce the expected output, Java is installed and working.
How to set JAVA_HOME for build tools
For most users, Java works immediately after installation. gave java And javac The commands are available without any additional setup.
However, some construction tools are required JAVA_HOME environmental variables. Apache Maven, Gradle, and the Android SDK all detect it. If you see errors mentioning “JAVA_HOME is not set” then you need this step.
If you only run a Java application or use IntelliJ IDEA (which manages Java paths internally), you can skip this section.
Add this line to your ~/.zprofile file:
export JAVA_HOME=$(/usr/libexec/java_home)
It uses Apple. java_home Utility to automatically detect installed JDK. After saving the file, you will need to run source ~/.zprofile Or close and reopen your terminal. Verify that it works:
\( echo \)JAVA_HOME
/Library/Java/JavaVirtualMachines/temurin-25.jdk/Contents/Home
For complete configuration instructions, see Set JAVA_HOME on the Mac..
How to troubleshoot common problems
“Failed to find Java Runtime” message keeps showing up. run java -version To verify that Java is installed. See if you just installed Java Unable to detect Java Runtime.
An invalid Java version is displayed. You have multiple JDKs installed and macOS has selected a different one. run /usr/libexec/java_home -V To list all installed versions. See Set JAVA_HOME on the Mac. to point to the version you want.
Alternative installation methods
Homebrew is the fastest way, but there are other options.
Manual download: You can download the .pkg installer directly from adoptium.net And double click to install. This is a good choice if you don’t use homebrew. See Install Java on Mac. For detailed instructions.
Homebrew formula. Order
brew install openjdk@25Installs the build managed by Homebrew. This approach requires manual symlink configuration before macOS can detect it. See Install java, formula method For detailsVersion managers. Tools like SDKMAN and mise can install and switch between multiple Java versions per project. See if you work on codebases that require different Java versions Java version managers.
What’s next?
Java 25 is now installed on your Mac. You have verified that it works and is configured. JAVA_HOME For construction tools. You are ready to compile and run Java applications.
If your team or university course requires Java 21, see Install Java 21 on Mac.. See if you need to remove Java Uninstall Java on Mac..
This article is based on my guides that provide additional details on how to. Install Java on Mac. and select The latest Java version.