Ubuntu

How to Install JDK 14 on Ubuntu 22.04

Java is a general-purpose and free-to-use programming language utilized for creating distributed and localized applications. This programming language is also used to develop computer, video, and mobile games. It assists in creating modern games that incorporate complex technology such as virtual reality and machine learning.

More specifically, “JDK” or “Java Development Kit” is a core component of Java that offers a software development environment for building Java applications. A private JVM or Java Virtual machine and some other resources are included in JDK, which plays their role in application development.

This write-up will discuss the method to install JDK 14 on Ubuntu 22.04. So, let’s start!

How to install JDK 14 on Ubuntu 22.04

For the installation of JDK 14 on Ubuntu 22.04, you must follow the below-given step-by-step instructions.

Step 1: Update system repositories

Press “CTRL+ALT+T” to open the terminal of the Ubuntu 22.04 and run the below-given command to update system repositories:

$ sudo apt update

Step 2: Download JDK 14 archive file on Ubuntu 22.04

After updating the system packages, utilize the following “curl” command to download the JDK 14 archive file:

$ curl -O https://download.java.net/java/GA/jdk14/076bab302c7b4508975440c56f6cc26a/36/GPL/openjdk-14_linux-x64_bin.tar.gz

Step 3: Extract JDK 14 archive file

Now, extract the downloaded JDK 14 archive file by executing the below-given “tar” command:

$ sudo tar xvf openjdk-14_linux-x64_bin.tar.gz

Step 4: Configure Java Environment

It’s time to configure the Java environment on your Ubuntu 22.04. To do so, firstly, move the extracted JDK 14 folder to the “/opt” directory:

$ sudo mv jdk-14 /opt/

Then, execute the following “tee” command:

$ sudo tee /etc/profile.d/jdk14.sh <<EOF

Type given statements to add the variable path for JDK 14 on your Ubuntu 22.04 system:

> export JAVA_HOME=/opt/jdk-14

> export PATH=\$PATH:\$JAVA_HOME/bin

> EOF

Now, write out the “source” command to execute the profile file “jdk14.sh”:

$ source /etc/profile.d/jdk14.sh

Step 5: Verify JDK version

Lastly, verify the existence of JDK 14 on Ubuntu 22.04 by either checking the Java variable path:

$ echo $JAVA_HOME

Or by validating the version of the installed JDK on your system:

$ java -version

The below-given output signifies that we have successfully installed JDK 14 on our Ubuntu 22.04:

We have provided the simplest method to install JDK 14 on Ubuntu 22.04. Give it a try and step into the world of application development.

Conclusion

To install JDK 14 on Ubuntu 22.04, download the JDK14 archive file using the “$ curl -O https://download.java.net/java/GA/jdk14/076bab302c7b4508975440c56f6cc26a/36/GPL/openjdk-14_linux-x64_bin.tar.gz” command, then extract the downloaded JDK file. After that, configure the Java environment and add the variable path on your Ubuntu 22.04 system. This write-up covered the method to install JDK 14 on Ubuntu 22.04.

About the author

Sharqa Hameed

I am a Linux enthusiast, I love to read Every Linux blog on the internet. I hold masters degree in computer science and am passionate about learning and teaching.