Java on Apple Silicon or Intel Macs
Java on Apple Silicon M-series or Intel Macs. How to install the correct Java version for your chip, verify ARM64 architecture, and configure for differences.
This article answers questions about Java development on newer Apple M-series Macs as well as older Macs that use Intel CPUs. Apple began selling M-series Macs in November 2020. Most developers use Apple M-series Macs, but if you need to run Java on an Intel-based Mac, you can do so.
Here's what you need to know:
- If you have an Apple M-series Mac, download and install Java for Apple Silicon ("arm64")
- If you have an an Intel-based Mac, download and install Java for Intel ("x64")
- Be careful not to download and install Java for Intel ("x64") if you have an Apple M-series Mac; it will run slowly.
Before you get started
You'll need a terminal application to develop with Java. 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.
What Mac CPU do I have?
- Click the Apple logo in the top-left corner of your screen.
- Select
About This Macfrom the dropdown menu. - A window will appear displaying your Mac model and year.
- The window shows "Chip" or "Processor",
If the chip is Apple M1, M2, M3, M4, M5 (or newer), you have an Apple Silicon M-series chip. If it lists an Intel Core (for example Intel Core i5), you have an Intel‑based Mac.
You can use a terminal application to check the CPU type. Learn How to Open Terminal in Mac and run:
$ uname -m
arm64
You'll see either arm64 for Apple Silicon or x86_64 for Intel.
Check terminal architecture
Before installing Java, verify your Terminal is running natively. This step prevents a common mistake where a package manager installs Intel packages instead of ARM64 on Apple Silicon Macs.
Run the command:
$ arch
If you have an Apple M-series Mac, you should see arm64 as the output. This confirms your terminal is running natively on Apple Silicon.
If you see i386 or x86_64, your terminal is running under Rosetta, the emulation software. The i386 output indicates 32-bit emulation mode, while x86_64 means 64-bit Intel emulation. Either way, you need to fix this before installing Java.
Fix terminal running under Rosetta
Rosetta 2 is a translation layer that lets Apple Silicon Macs run apps built for Intel processors by converting x86_64 instructions to ARM. Apple designed Rosetta specifically to smooth the Intel‑to‑Apple‑silicon transition so older Mac software keeps working on newer M-series Mac. If you have an Apple M-series Mac, don't use Rosetta to install and run Java as it's slow.
Here's how to disable Rosetta for Terminal:
- Quit Terminal completely
- Open Finder and navigate to Applications → Utilities
- Right-click Terminal and select "Get Info"
- Uncheck "Open using Rosetta"
- Close the Info window and reopen Terminal
- Run
archagain to confirm it now showsarm64
This fix is essential so you don't end up with Intel Java that runs slowly through Rosetta translation.
Check for existing Java installations
See what Java versions you already have installed:
$ /usr/libexec/java_home -V
This command lists all installed JDKs with their architectures. Look for (arm64) versus (x86_64) next to each version. If you have Intel versions installed, consider removing them to avoid confusion.
If no Java is installed, you'll see a message saying no Java runtime is present.
How to install Java
My guide Install Java on Mac explains your options for installing Java. You'll need to pick a Java version (I recommend the latest Java version). And Java is available from several vendors.
For most developers, the Eclipse Temurin distribution is the best choice. Temurin offers free, certified builds that work reliably for general development. You'll find Temurin Java builds for Apple Silicon or Intel Macs, except Temurin does not offer the oldest Java 8 for Apple Silicon.
After picking version and vendor, you have a choice of installing Java with Homebrew, the Mac software package manager, or downloading and running an installer package. I recommend using Homebrew, specifically to Brew Install Java With the Cask Method for Eclipse Temurin.
On Apple Silicon, Homebrew installs to /opt/homebrew rather than /usr/local (which was used on Intel Macs). This separation keeps ARM64 and Intel packages distinct. Homebrew automatically detects whether your terminal is running on Apple Silicon or Intel (but make sure the terminal isn't running under Rosetta as described above). With the cask method, Homebrew installs Java without needing additonal configuration, except you might need to Set JAVA_HOME.
Java 8 on Apple Silicon
Temurin does not offer Java 8 for Apple Silicon. If your project requires Java 8, use Azul Zulu or Amazon Corretto. Azul pioneered Apple Silicon support and remains the most reliable option for legacy Java versions on ARM64.
To install Java 8 for Apple Silicon using the Homebrew cask method:
$ brew install --cask zulu@8
Or with Amazon Corretto:
$ brew install --cask corretto@8
Both distributions provide fully native ARM64 builds of Java 8, so you get full performance without Rosetta translation.
Read Install JDK on Mac for detailed comparison of all Java distributions.
Configure your environment
After installation, set up your shell environment so Java works correctly from any terminal session.
Add these lines to your ~/.zprofile file:
export JAVA_HOME=$(/usr/libexec/java_home -v 25)
export PATH="$JAVA_HOME/bin:$PATH"
Apply changes with source ~/.zprofile or open a new Terminal window.
See the articles Mac Shell Configuration and Set Mac Path for complete instructions.
The /usr/libexec/java_home utility dynamically finds the correct JDK path. This approach is better than hardcoding a path because it automatically adapts when you update Java versions.
For detailed JAVA_HOME configuration, including version-switching functions and troubleshooting, see Set JAVA_HOME on Mac.
Check Java version
$ java -version
You should see output similar to:
$ java -version
openjdk version "25.0.1" 2025-10-21 LTS
OpenJDK Runtime Environment Temurin-25.0.1+12 (build 25.0.1+12-LTS)
OpenJDK 64-Bit Server VM Temurin-25.0.1+12 (build 25.0.1+12-LTS, mixed mode)
Verify ARM64 architecture
The java -version output doesn't explicitly show architecture. On Apple Silicon, use this command to confirm you have the native ARM64 build:
$ java -XshowSettings:properties -version 2>&1 | grep os.arch
You should see:
$ java -XshowSettings:properties -version 2>&1 | grep os.arch
os.arch = aarch64
The value aarch64 confirms native ARM64 execution. This is the canonical term Java uses for ARM64 architecture. If you see x86_64 instead, you installed the Intel version.
Check binary type
You can also inspect the Java binary directly:
$ file $JAVA_HOME/bin/java
Correct output for native ARM64:
$ file $JAVA_HOME/bin/java
/Library/Java/JavaVirtualMachines/temurin-25.jdk/Contents/Home/bin/java: Mach-O 64-bit executable arm64
If it shows x86_64 instead of arm64, you installed the Intel version.
List all installed JDKs
See every Java installation on your system with architecture information:
$ /usr/libexec/java_home -V
Sample output:
$ /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
25.0.1 (arm64) "Eclipse Adoptium" - "OpenJDK 25.0.1" /Library/Java/JavaVirtualMachines/temurin-25.jdk/Contents/Home
21.0.3 (arm64) "Azul Systems, Inc." - "Zulu 21.34.19" /Library/Java/JavaVirtualMachines/zulu-21.jdk/Contents/Home
Each entry shows the architecture in parentheses. All your JDKs should show (arm64) for optimal performance, if you are on Apple Silicon.
Performance considerations
Native ARM64 Java delivers substantial performance improvements over Intel Java running under Rosetta.
Speed and battery life
Real-world developer testing shows dramatic differences:
Apple Silicon performance comparison
- Maven build time – ~85 seconds (native ARM64) vs ~223 seconds (Intel via Rosetta), 2.6x faster
- General execution – Baseline (native ARM64) vs 50–80% speed (Intel via Rosetta), ~2x faster
- Battery life (MacBook Air) – ~10 hours (native ARM64) vs ~2.5 hours (Intel via Rosetta), 4x longer
The unified memory architecture in Apple Silicon chips particularly benefits garbage collection. Memory-intensive JVM operations run faster because the CPU and GPU share memory without transfer overhead.
Java 25 adds compact object headers that reduce memory usage by 22%, which further improves performance on memory-constrained devices.
Build tool cerformance
Maven and Gradle are pure Java. They run on whatever JDK you have installed. With a native ARM64 JDK, build times improve dramatically. Developers working on Android projects report 20-35% faster builds compared to running under Rosetta.
No special tuning required
The JVM automatically detects Apple Silicon and configures itself appropriately. You don't need Apple Silicon-specific JVM flags or settings. Standard memory and thread tuning applies just like on any other platform.
Migrating from an Intel Mac
If you're moving to a new Apple Silicon Mac, install Java fresh rather than copying from your old Mac.
Don't copy Intel installations
Never copy Intel Java installations to an Apple Silicon Mac using Migration Assistant or manual file transfer. Those are x86_64 binaries that will run slowly under Rosetta. Always do a fresh installation of ARM64 builds.
Project compatibility
Your Java source code and project files work unchanged. Java bytecode is platform-independent so a JAR compiled on Intel runs identically on ARM64. Only the JDK binary differs between architectures.
However, review these dependencies if your project uses them:
- JNA: Update to 5.7.0+ for ARM64 support
- Testcontainers: Update to 1.15.3+
- Docker images: Use ARM64 variants when available
Rosetta 2 compatibility
While native ARM64 Java is strongly recommended, Rosetta 2 translation does work for Intel Java binaries. Here's what to know.
When Rosetta might be needed
Rosetta-translated Java may be necessary for:
- Legacy JNI libraries compiled only for x86_64
- Older testing frameworks without ARM64 support
- Specific legacy applications with native dependencies
Performance impact
Expect roughly half the performance when running Intel Java under Rosetta. The translation layer adds overhead for instruction conversion, and Java's JIT compiler compounds this. It generates x86 code that Rosetta must translate, rather than native ARM64 code.
How to run Under Rosetta
If you must run Intel Java for a specific application:
$ arch -x86_64 java -jar legacy-app.jar
This forces the java process to run under Rosetta translation.
Rosetta's future
Apple will remove Rosetta 2 from macOS 28 (expected 2027). Plan to migrate all dependencies to native ARM64 builds before then to avoid disruption. This timeline gives you time to update any legacy x86_64 dependencies.
Frequently Asked Questions
Does Java work on M1/M2/M3/M4/M5 Macs?
Yes. Java runs on all Apple Silicon Macs, both under Rosetta (with an Intel build) and natively (with an ARM64 build). Native Java has been officially supported since JDK 17 and offers full performance and functionality.
Which Java should I install?
For most developers: Eclipse Temurin JDK 25. It's the current LTS version with excellent ARM64 support and free licensing. For Java 8 requirements, use Azul Zulu. It's the only major free distribution offering Java 8 ARM64 for Mac.
Is Java bytecode different on Apple Silicon?
No. Java bytecode is identical across all platforms. A JAR compiled on an Intel Mac runs on an ARM64 Mac without modification. Only the JDK binary and runtime JIT compilation differ between architectures.
Do I need special JVM settings for Apple Silicon?
No. The JVM detects Apple Silicon automatically and configures itself appropriately. Apply standard memory or thread tuning as needed for your application, but no Apple Silicon-specific flags are required.
Can I run Intel Java if needed?
Yes. Intel Java runs under Rosetta 2 translation. Expect roughly half the performance. Use it only when necessary for legacy compatibility, and plan to migrate to native ARM64 builds.
What happens when Apple removes Rosetta?
Apple will remove Rosetta 2 from macOS 28 (expected 2027). After that, only native ARM64 applications will run. Install native ARM64 Java now to ensure long-term compatibility.
What's Next
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.