Install JDK 8 and Setup JAVA_HOME on Mac M1

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”

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

echo $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:
scroll down and download the .dmg file than execute it.

Set JAVA_HOME path permanently in macOS

nano ~/.zshrc

and add it to the path

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

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

source ~/.zshrc

2 thoughts on “Install JDK 8 and Setup JAVA_HOME on Mac M1”

Leave a Comment

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