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.
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
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
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 export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents$
save and close the file (Control + X).
Than activate the changes.
2 thoughts on “Install JDK 8 and Setup JAVA_HOME on Mac M1”
The blog has merged ‘–‘ into mdash ‘—’ breaking the commands.
Thank you! I have updated the article