Direct Answer & TL;DR
- Installation:
brew install --cask corretto@25— that’s the whole thing. Install Homebrew first if you haven’t. Everything else is in this post. - Why Corretto: It’s free, it’s what Amazon runs on thousands of production services, it’s Java SE TCK-certified, and it comes with LTS support at no cost.
I’m struggling to think of a reason to pay for Oracle JDK. - JDK 25 is LTS: The next long-term support release after JDK 21. Virtual thread maturity, AOT improvements, AI-friendly APIs — it’s worth getting familiar with now.
Background: “Do I really need to upgrade Java again?”
Honestly, upgrading Java versions used to be the thing I’d kick down the road indefinitely. If it’s running fine, why touch it? I suspect I’m not alone in that.
It came up during a recent side project cleanup — Spring Boot 3.x work that made me revisit my JDK setup. (Related: Spring Boot 2.7 → 4.0 Migration Strategy) I was on JDK 21 LTS and kept seeing Corretto 25 show up in Homebrew. Since 25 is LTS, it made sense to just switch now rather than wait.
The installation itself is trivial. What I want to share — and what I got wrong the first time — is the JAVA_HOME configuration. Hardcoding the path is a quiet trap that breaks silently after a Homebrew patch update. Let me show you the right way.
Why Amazon Corretto?
Before the commands: there are many JDK distributions beyond Oracle. Here’s why Corretto is a reasonable default for most developers.
Corretto’s Key Advantages
| Feature | Details |
|---|---|
| Free LTS | Long-term support at zero cost, unlike Oracle JDK’s commercial LTS |
| Amazon Production-Tested | Runs on thousands of AWS services internally — not a lab distribution |
| Java SE TCK Certified | Fully compliant with the official Java SE standard |
| Multiplatform | macOS, Linux, Windows, and Docker images all supported |
| Quarterly Security Patches | Critical fixes also released outside the regular patch schedule |
| Container-Optimized | Tuned memory management and startup times for cloud-native workloads |
| Open Source (OpenJDK) | Fully transparent, community-auditable source |
[!NOTE] Particularly recommended if you:
- Want a stable, no-cost JDK for side projects or startups
- Deploy on AWS / ECS / Lambda (Corretto is Amazon Linux’s default JDK)
- Work with Spring Boot, Quarkus, or other enterprise-grade Java frameworks
What’s New in JDK 25
JDK 25 is the next LTS release after JDK 21. Key highlights:
- Virtual Thread Maturity: Reduced thread pinning, more stable high-concurrency behavior
- Structured Concurrency (finalizing): Treat related tasks across threads as a single unit — cleaner cancellation and error propagation
- Scoped Values: Efficient immutable data sharing across threads; a better alternative to
ThreadLocalin virtual-thread-heavy code - AOT Improvements (Project Leyden): Ahead-of-time class loading and linking — faster server startup times
- JFR Enhancements: CPU-time profiling on Linux, cooperative sampling, method timing
- AI-Friendly APIs: Primitive types in pattern matching, Vector API improvements
[!TIP] JDK 25 GA shipped on September 16, 2025. The
corretto@25Cask is already available in Homebrew — install and go. LTS means what you learn today stays relevant for years.
Prerequisites: Verify Homebrew
If Homebrew isn’t installed yet:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Already installed? Just check the version:
brew --version
Running brew update before installing Corretto is worth the 60 seconds — if the corretto@25 Cask was added or updated recently, you’ll get the latest without issues.
Step-by-Step Installation
Step 1. Update Homebrew package list
brew update
This syncs the Cask repository so Homebrew knows about corretto@25. Skip this and you might get a “cask not found” error. Speaking from experience.
Step 2. Install Amazon Corretto 25
brew install --cask corretto@25
Corretto 25 will be installed under /Library/Java/JavaVirtualMachines/ — the standard macOS JVM path.
[!NOTE] The
--caskflag is required.brew install corretto@25(non-cask) refers to a different package. Casks are for software installed via.pkg— which includes JDKs on macOS.
Step 3. Set JAVA_HOME dynamically (important)
This is the part that trips people up. My first attempt looked like this:
# ❌ Don't do this — hardcoded path
export JAVA_HOME="/Library/Java/JavaVirtualMachines/amazon-corretto-25.jdk/Contents/Home"
The problem: Homebrew changes the directory name when it patches a minor version. This config breaks silently, and you’ll discover it at the worst possible moment — usually when trying to build a new project.
The correct approach uses macOS’s built-in java_home utility to resolve the path dynamically:
# ✅ Do this instead — dynamic resolution
echo 'export JAVA_HOME=$(/usr/libexec/java_home -v 25)' >> ~/.zshrc
echo 'export PATH=$JAVA_HOME/bin:$PATH' >> ~/.zshrc
[!TIP]
/usr/libexec/java_home -v 25is a macOS-specific tool that finds the correct home path for the requested Java version at runtime. It stays accurate across Homebrew updates without any manual intervention.
Step 4. Apply to the current terminal session
source ~/.zshrc
New terminals will pick this up automatically — this just saves you from opening a new tab right now.
Step 5. Verify the installation and check architecture
java -version
Expected output on an Apple Silicon Mac:
openjdk version "25.0.2" 2026-01-20 LTS
OpenJDK Runtime Environment Corretto-25.0.2.10.1 (build 25.0.2+10-LTS)
OpenJDK 64-Bit Server VM Corretto-25.0.2.10.1 (build 25.0.2+10-LTS, mixed mode, sharing)
For a more explicit architecture check:
java -XshowSettings:all -version 2>&1 | grep "os.arch"
# Expected: os.arch = aarch64
aarch64 confirms native ARM execution — no Rosetta emulation, full Apple Silicon performance.
Managing Multiple JDK Versions
Real-world development often involves different JDK versions across projects. Useful commands:
# List all installed JDK versions
/usr/libexec/java_home -V
# Temporarily switch to a specific version (current session only)
export JAVA_HOME=$(/usr/libexec/java_home -v 21)
# Confirm active JAVA_HOME
echo $JAVA_HOME
[!NOTE] If you frequently switch between JDK versions across projects, consider jenv or SDKMAN! for a more automated workflow. For my current setup with a few projects, manual switching is sufficient.
Closing: Small Config Decision, Big Downstream Difference
The install is one line. The environment variable setup is three lines. But whether you hardcode that path or resolve it dynamically makes a real difference when Homebrew inevitably patches something six months from now.
Amazon Corretto isn’t “just a free JDK alternative.” It’s what Amazon uses in production, across thousands of services. When someone asks why you’re using Corretto, “because AWS trusts it” is a pretty solid answer.
JDK 25 is LTS. Set it up properly once, and you can focus on building things rather than managing toolchain surprises for years. Until the next LTS drops and we do this all over again.