How to Install Java OpenJDK 16 on macOS Big Sur
source link: https://knasmueller.net/how-to-install-java-openjdk-16-on-macos-big-sur
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
How to Install Java OpenJDK 16 on macOS Big Sur
In this article, I will demonstrate how to install Java OpenJDK 16 on macOS Big Sur in 2021.
Update: I have created a video tutorial on how to install OpenJDK on macOS Big Sur:
If you prefer written instructions, just keep reading:
Download and Install OpenJDK 16
Download the .tar.gz
version of OpenJDK 16 from jdk.java.net/16/ and move the file to /Library/Java/JavaVirtualMachines/ on your mac. Then, extract it and delete the archive:
sudo mv openjdk-16.0.1_osx-x64_bin.tar.gz /Library/Java/JavaVirtualMachines/ cd /Library/Java/JavaVirtualMachines/ sudo tar -xzf openjdk-16.0.1_osx-x64_bin.tar.gz sudo rm openjdk-16.0.1_osx-x64_bin.tar.gz
Next, execute the following command to find out where JDK 16 is located:
$ /usr/libexec/java_home -v16 /Library/Java/JavaVirtualMachines/jdk-16.jdk/Contents/Home
and append the resulting path as an export into your .bash_profile
(or, change the existing JAVA_HOME
entry in your .bash_profile
if it already exists):
echo -n "\nexport JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-16.jdk/Contents/Home" >> ~/.bash_profile
and make sure to apply the changes:
source ~/.bash_profile
Test Java
You should now be able to run java:
java -version
You should then see an output similar to the following:
openjdk version "16" 2021-03-16 OpenJDK Runtime Environment (build 16+36-2231) OpenJDK 64-Bit Server VM (build 16+36-2231, mixed mode, sharing)
Congratulations! You have installed OpenJDK 16.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK