How to Install Java JDK on Mac and set JAVA_HOME

Published: 30 July 2022
on channel: MobileTesting
8,601
37

In this videos we'll see how to install Java JDK on Mac and set JAVA_HOME in the path using the ~/.zshrc file

Error:
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

Command to install Java in Mac:

brew search java
brew info java
brew install java
ls /usr/local/Cellar/openjdk
ls /usr/local/opt/openjdk
sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
java -version

Commands to install openjdk java version 8
brew search openjdk
brew install openjdk@8
sudo ln -sfn /usr/local/opt/openjdk@8/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-8.jdk


Set the JAVA_HOME in ~/.zshrc file
vim ~/.zshrc
export JAVA_HOME=/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/
source ~/.zshrc
java -version

To see all versions of Java installed in the Machine:
ls -lsa /Library/Java/JavaVirtualMachines

#java #javajdk #jdk #installjava #javainstall #mac


On this page of the site you can watch the video online How to Install Java JDK on Mac and set JAVA_HOME with a duration of hours minute second in good quality, which was uploaded by the user MobileTesting 30 July 2022, share the link with friends and acquaintances, this video has already been watched 8,601 times on youtube and it was liked by 37 viewers. Enjoy your viewing!