Install Java on MAC

Install Java on MAC

373
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 openjdk
Next paste following line and hit enter

sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
It 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 --version
If your installation was successful you should see your java version.
 


- Last updated 1 year ago

Be the first to leave a comment.

You must login to leave a comment