How to install Zulu Open JDK 12 on Debian GNU/Linux 9 (Stretch)?

How to install Zulu Open JDK 12 on Debian GNU/Linux 9 (Stretch)?

Zulu Enterprise™ is a commercialized build of OpenJDK™ and is certified compatible and compliant with the Java SE specification. The 100% open source Zulu JDK is simple to install and requires no coding changes to your Java application. Installing Zulu Java Development Kit 12 in Debian Linux 9 is really a simple. Here are the step by step procedure to install the Zulu Open JDK in Debian Linux 9 Operating System. – by www.azul.com

download JDK

You can download the Zulu Open JDK .tar file from Azul official site. https://www.azul.com/downloads/zulu-community/

Open the terminal and create a new “jvm” folder under /usr/lib directory.

sudo mkdir /usr/lib/jvm

Then change the directory /usr/lib/jvm.

cd /usr/lib/jvm/
Create a new JVM directory

wget download

Now, download the .tar file JDK by using wget command.

sudo wget https://cdn.azul.com/zulu/bin/zulu12.3.11-ca-jdk12.0.2-linux_x64.tar.gz

After download the file, then extract it.

sudo tar -xvzf zulu12.3.11-ca-jdk12.0.2-linux_x64.tar.gz

set environment and java_home Path

Open the nano editor to set the JAVA Path and JAVA_HOME path by using below command.

sudo nano /etc/environment

Add below lines into your text editor after executing the nano command.

PATH="/usr/lib/jvm/zulu12.3.11-ca-jdk12.0.2-linux_x64/bin"
JAVA_HOME="/usr/lib/jvm/zulu12.3.11-ca-jdk12.0.2-linux_x64"

Then, save the file. Next step is inform to Linux where Java is located in that system.

update alternatives

Execute the following commands to set the Java alternatives in Linux machine.

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/zulu12.3.11-ca-jdk12.0.2-linux_x64/bin/java" 0
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/zulu12.3.11-ca-jdk12.0.2-linux_x64/bin/javac" 0
sudo update-alternatives --set java /usr/lib/jvm/zulu12.3.11-ca-jdk12.0.2-linux_x64/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/zulu12.3.11-ca-jdk12.0.2-linux_x64/bin/javac

To verify the setup execute the following commands and it will print the location of the java and javac path.

update-alternatives --list java 
update-alternatives --list javac 

check java version

Restart the computer or logout and login once again. After that, execute the following command to check the java version.

java -version

You can see the following output in the console window.

openjdk version "12.0.2" 2019-07-16

OpenJDK Runtime Environment Zulu12.3+11-CA (build 12.0.2+3)

OpenJDK 64-Bit Server VM Zulu12.3+11-CA (build 12.0.2+3, mixed mode, sharing)
Advertisements