Install JDK in MacOS

From Chorke Wiki
Jump to navigation Jump to search
/usr/libexec/java_home -V 

GraalVM

sudo wget -c https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/\
 graalvm-ce-java17-darwin-amd64-22.0.0.2.tar.gz -P /Library/Java/JavaVirtualMachines/

sudo tar -xvzf /Library/Java/JavaVirtualMachines/graalvm-ce-java17-darwin-amd64-22.0.0.2.tar.gz\
 -C /Library/Java/JavaVirtualMachines/

sudo rm -rf /Library/Java/JavaVirtualMachines/graalvm-ce-java17-darwin-amd64-22.0.0.2.tar.gz 
export GRAALVM_HOME=`/usr/libexec/java_home -v22.0.0.2`
export JAVA_HOME=`/usr/libexec/java_home -v22.0.0.2`

Uninstall

/usr/libexec/java_home -v1.8.0_321
/usr/libexec/java_home -v1.8.0_241
/usr/libexec/java_home -v22.0.0.2
/usr/libexec/java_home -v1.7.0_80
/usr/libexec/java_home -v1.8.0
sudo rm -rf /Library/Java/JavaVirtualMachines/graalvm-ce-java17-22.0.0.2/
sudo rm -rf /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-11.0.6.jdk/

References