Install JDK 8 and Setup JAVA_HOME on Mac M1

Erwin Schleier
1 min readJul 5, 2022

Macs are awesome! For developers there is no better alternative on my opinion right now. So I got a new Mac Book Pro with a M1 chip. Despite it’s beauty there are some setup challenges. One of them is installing JDK8. To make the transition easy, the following guides you through the installation process.

Homebrew Setup

As a pre requisition homebrew has to be installed.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Add Homebrew to your PATH

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/vishal/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)"

Test if Homebrew is in your PATH

Install JAVA

Next of course, you have to install Java if not already done.

Install Rosetta 2

sudo softwareupdate --install-rosetta

Install Java using Homebrew

brew tap adoptopenjdk/openjdk && brew install --cask adoptopenjdk8

Install OpenJDK8

And finally you can install JDK8. Therefore go to: https://www.azul.com/downloads/?version=java-8-lts&os=macos&architecture=arm-64-bit&package=jdk
scroll down and download the .dmg file than execute it.

Set JAVA_HOME path permanently in macOS

and add it to the path

export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home

save and close the file (Control + X).
Than activate the changes.

source ~/.zshrc

Originally published at https://erwin-schleier.com.

--

--