Skip to content

Install java 8 on Mac OS X

shrutig0510 edited this page Oct 13, 2021 · 5 revisions

Install java8 using brew

brew update

brew tap adoptopenjdk/openjdk

brew install --cask adoptopenjdk8

Note: If there are two or more versions of java installed and wanted to set the default one

nano ~/.zshrc

export JAVA_HOME_8=$(/usr/libexec/java_home -v1.8)
export JAVA_HOME_11=$(/usr/libexec/java_home -v11)
alias java8=‘export JAVA_HOME=$JAVA_HOME_8’
alias java11=‘export JAVA_HOME=$JAVA_HOME_11’
#set default
java8

source ~/.zshrc