Visit Azul.com Support

Manage Multiple Azul Zulu Versions on Linux

Table of Contents
Need help?
Schedule a consultation with an Azul performance expert.
Contact Us

You can install different major versions of Azul Zulu on the same machine and switch between them when necessary.

Update PATH environment variable

You can add <zulu_installation_folder>/bin to your PATH environment variable.

 
export PATH=<zulu_installation_folder>/bin:$PATH

This makes all executables from <zulu_installation_folder>/bin available to Java programs from anywhere on your system. If you have previously added another version of Azul Zulu to PATH, just change the path to the version you want to use by default.

Change default java command

If you installed multiple JREs and JDKs using DEB or RPM packages, you can use the Linux command update-alternatives to set which is used system-wide by default to make the java command and related commands like javac and `jcmd available to users.

To view and potentially change the currently installed JREs providing the java command, run the command below. This will also automatically change related JRE commands like keytool.

 
$ sudo update-alternatives --config java There are 3 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/lib/jvm/zulu-15-amd64/bin/java 2152700 auto mode 1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode 2 /usr/lib/jvm/zulu-15-amd64/bin/java 2152700 manual mode 3 /usr/lib/jvm/zulu8/jre/bin/java 1805201 manual mode Press <enter> to keep the current choice[*], or type selection number:

The command lists available java executables and lets you choose the default command. Type the number of the command and press Enter. You should see a messages similar to this:

 
update-alternatives: using /usr/lib/jvm/zulu8/jre/bin/java to provide /usr/bin/java (java) in manual mode

Verify that the default java command has changed:

 
java -version

Change default javac command

To view and potentially change the currently installed JDKs providing the javac command, run the command below. This will also automatically change related JDK commands like jcmd:

 
sudo update-alternatives --config javac