- Go to https://www.oracle.com/in/java/technologies/downloads choose mac
- download and click on install
- once installed open the terminal
- check if java is installed
java --version
5. In the terminal write the following
a. touch ~/.zshenv
then
b. open ~/.zshenv
Once you execute the above 2 commands a new window will open where you need to set the home variable, write the code in the screenshot below
export JAVA_HOME=$(/usr/libexec/java_home)

finally when you run the command you will see the JDK
echo $JAVA_HOME

6. After the setup write a small program and check if you are able to run JAVA programs