Migrating from Adopt OpenJDK to Adoptium on Mac

Adopt OpenJDK is officially deprecated and is moved to the Eclipse Temurin project. So the Homebrew Tap for AdoptOpenJdk is also deprecated.

So we must first remove the AdoptOpenJdk tap from Homebrew:

# Uninstall the AdoptOpenJDK tap
brew untap AdoptOpenJDK/openjdk

In the next step we’ve two options. We can install the latest Temurin release or a specific one.

# Option 1: Install latest Temurin release
brew install --cask temurin

# Option 2: Install a specific Temurin release
brew tap homebrew/cask-versions
brew install --cask temurin11

You can set the JAVA_HOME variable with the following snipset in your login script:

# set JAVA_HOME to current Java version
export JAVA_HOME=$(/usr/libexec/java_home)

# set JAVA_HOME to a specific Java version
export JAVA_HOME=/Library/Java/JavaVirtualMachines/<version>/Contents/Home

Leave a Reply

Your email address will not be published. Required fields are marked *

two − 2 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.