- First run the command
java -version
for check the java version. If Java is not available in your local machine then it will return the below message.
.
- Go to - https://www.oracle.com/java/technologies/downloads/#jdk17-mac. and download Arm 64 DMG Installer. Select your desire java version. as i select JAVA 17. then install "Arm 64 DMG Installer" for Mac (m1) and for other intel version install "x64 DMG Installer"
Install it and again run command
Java successfully install your local machine. After that run
echo $JAVA_HOME
/usr/libexec/java_home
touch ~/.zshrc
open ~/.zshenv
and write export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-17.0.5.jdk/Contents/Home
after that run cat command for reads data from the file and gives their content as output
cat ~/.zshrc
echo $JAVA_HOME
Java home yet not save to save it Run
source ~/.zshrc
Run source command for reads and executes the file content in the current shell.
Again run
echo $JAVA_HOME
It return JAVA_HOME path.
Top comments (1)
youtube.com/watch?v=ZeDBQ0d2P5M