how to change java home version mac code example
Example 1: how to set the java_home in mac
Step-1: open terminal and type ls -al
if you did not find the .bash_profile proceed with Step-2 else continue with Step-3
Step-2: touch .bash_profile
Step-3: open -e .bash_profile
Step-4: export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_281.jdk/Contents/Home
Step-5: save it and close it
Step-6: source ~/.bash_profile
Step-7: echo $JAVA_HOME
Example 2: change default java version mac
nano ~/.zshrc
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8.0)