OPEN TERMINAL AND,
go to the home folder with
cd ~/
create .profile file
touch . bash_profile
in -zsh terminal type
nano ~/.bash_profile
in nano~/.bash_profile type
export JAVA_HOME=$(/usr/libexec/java_home)source ~/.bashrc
Save and Close
It will be addressed any version of JDK which is located shown below
JUST BE SURE THERE IS ONLY ONE JDK OVER HERE.
EVEN IF YOU CHANGED THE JAVA VERSION HERE IT WILL BE AUTOMATICALLY SET UP BEFORE DOING NOTHING.
/Library/Java/JavaVirtualMachines/{YOUR JDK VERSION}/Contents/Home
close the terminal and open a new one and check the results it will be something like shown below
java -version
javac -version
mvn -version
YOU DID GREAT. KEEP CODING…