In this article we are going to learn how to install openjdk (Java) with brew on MacOS.Open terminal and paste following line and hit enter
brew install openjdkNext paste following line and hit enter
sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdkIt will ask for your password to access root level (sudo).Copy following line to export your java files
export JAVA_HOME="/Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Home"Now you can check your java version by following command.
java --versionIf your installation was successful you should see your java version.
- Last updated 7 months ago