Download from Archived OpenJDK General-Availability Releases.
wget https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_osx-x64_bin.tar.gz
Unzip the ʻopenjdk-11.0.2_osx-x64_bin.tar.gz file to
/ Library / Java / JavaVirtualMachines / `.
sudo tar zxvf openjdk-11.0.2_osx-x64_bin.tar.gz -C /Library/Java/JavaVirtualMachines/
Change the owner / owning group of the file.
sudo chown -R root:wheel /Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk
Make sure that ʻOpenJDK` is recognized.
/usr/libexec/java_home -V
Register the JAVA_HOME
environment variable.
export JAVA_HOME=`/usr/libexec/java_home -v 11.0.2`
Execute the java
command and check the operation.
java -version
Since macOS Catalina 10.15
uses zsh, change the ~ / .zprofile
file.
vi ~/.zprofile
export JAVA_HOME=`/usr/libexec/java_home -v 11.0.2`
Recommended Posts