Manage Multiple Azul Zulu Versions on macOS
If you use a DMG installer to install Azul Zulu, the default installation directory is /Library/Java/JavaVirtualMachines/<azul_zulu_folder>/
.
The <azul_zulu_folder>
represents the type of Azul Zulu package (JDK or JRE) and its version, for example zulu-11.jdk
.
You can view all Azul Zulu versions installed on your Mac by navigating to the JavaVirtualMachines
directory. Use Finder or launch Terminal and run the following command:
% ls -1 /Library/Java/JavaVirtualMachines/
zulu-11.jdk
zulu-13.jre
zulu-15.jdk
zulu-8.jdk
To see which version of Java is used by default, use the java_home
tool:
% /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/zulu-15.jdk/Contents/Home
To execute a different version of Java, use the following command:
% /usr/libexec/java_home -v 11 --exec java -version
openjdk version "11.0.11" 2021-04-20 LTS
OpenJDK Runtime Environment Zulu11.48+21-CA (build 11.0.11+9-LTS)
OpenJDK 64-Bit Server VM Zulu11.48+21-CA (build 11.0.11+9-LTS, mixed mode)
# For Java 8, you need to use "1.8"
% /usr/libexec/java_home -v 1.8 --exec java -version
openjdk version "1.8.0_342"
OpenJDK Runtime Environment (Zulu 8.64.0.15-CA-macos-aarch64) (build 1.8.0_342-b07)
OpenJDK 64-Bit Server VM (Zulu 8.64.0.15-CA-macos-aarch64) (build 25.342-b07, mixed mode)