December 7, 2023

How to Set JAVA_HOME environment variable on macOS

This article shows how to set the $JAVA_HOME environment variable on older Mac OS X and the latest macOS 11. Steps to set the $JAVA_HOME environment variable on macOS: 1 – Find out your macOS version; 2 – Find out which shell you are using, bash or zsh? ; 3 – For zsh shell, export $JAVA_HOME at ~/.zshenv or ~/.zshrc ; 4 – For bash shell, export $JAVA_HOME at ~/.bash_profile or ~/.bashrc ; 5 – Test with echo $JAVA_HOME.

How to Set JAVA_HOME environment variable on macOS Read More