29.9 C

How To Install Oracle Java 14 on Ubuntu 20.04

Today we are going to learn that how to install Java 14 on Ubuntu 20.04. As Java is the most popular programming language to develop different types of Android, Web and other business applications. It is also used in developing the games and other such projects. Java 14 is now available and you can find the new features in this by visiting the official release page of Java 14 to view interesting features. So, let’s move towards the installation of the Java on our Ubuntu system.

Install Java 14 on Ubuntu 20.04

Visit the official page of Java SE Development Kit to download the latest version of Java as Java 14. But here we’ll use the command wget and curl in order to get the package to install. So first of all update the system and get wget & curl.

sudo apt update 

Then run the below command to add the Java 14 repository on Ubuntu 20.04.

- Advertisement -
 sudo add-apt-repository ppa:linuxuprising/java 

After adding the Java 14 repository on Ubuntu 20.04, you can install the Oracle Java 14 by hitting the below command.

sudo apt -y install oracle-java14-installer


Download done.
Removing outdated cached downloads…
update-alternatives: using /usr/lib/jvm/java-14-oracle/bin/jpackage to
provide /usr/bin/jpackage (jpackage) in auto mode
Oracle JDK 14 installed
To set Oracle JDK 14 as default, install the "oracle-java14-set-default
" package.
E.g.: sudo apt install oracle-java14-set-default.
Selecting previously unselected package oracle-java14-set-default.
(Reading database … 167881 files and directories currently installed.
Preparing to unpack …/oracle-java14-set-default_14.0.1-1~linuxuprisin
g1_amd64.deb …
Unpacking oracle-java14-set-default (14.0.1-1~linuxuprising1) …
Selecting previously unselected package gsfonts.
Preparing to unpack …/gsfonts_1%3a8.11+urwcyr1.0.7~pre44-4.4_all.deb

Unpacking gsfonts (1:8.11+urwcyr1.0.7~pre44-4.4) …
Selecting previously unselected package gsfonts-x11.
Preparing to unpack …/gsfonts-x11_0.27_all.deb …
Unpacking gsfonts-x11 (0.27) …
Setting up oracle-java14-set-default (14.0.1-1~linuxuprising1) …
Setting up gsfonts (1:8.11+urwcyr1.0.7~pre44-4.4) …
Setting up gsfonts-x11 (0.27) …
Processing triggers for fontconfig (2.13.1-2ubuntu3) …
Processing triggers for desktop-file-utils (0.24-1ubuntu2) …
Processing triggers for mime-support (3.64ubuntu1) …
Processing triggers for hicolor-icon-theme (0.17-2) …
Processing triggers for gnome-menus (3.36.0-1ubuntu1) …
Processing triggers for shared-mime-info (1.15-1) …

Then accept the License agreement when prompted.

On the next step, accept digital licence technology agreement to proceed further.

And then set up the Java 14 Environment variables by typing below command in your terminal.

sudo nano /etc/profile.d/jdk.sh
export JAVA_HOME=/usr/lib/jvm/java-14-oracle
export PATH=$PATH:$JAVA_HOME/bin

Finally, source the file

source /etc/profile.d/jdk.sh

Verify the version of java using below command on Ubuntu 20.04.

java --version
sabi@Ubuntu:~$ java --version
java 14.0.1 2020-04-14
Java(TM) SE Runtime Environment (build 14.0.1+7)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)

How To Set Java 14 as Default Java Version on Ubuntu 20.04

To make the Java 14 default version, type the following command.

sabi@Ubuntu:~$ 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/java-11-openjdk-amd64/bin/java 1111 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode
2 /usr/lib/jvm/java-14-oracle/bin/java 1091 manual mode
3 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
Press to keep the current choice[*], or type selection number: 2

And select the number from the list to be make default and press enter.

So, this is how you can install Java 14 on Ubuntu 20.04.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


Please enter your comment!
Please enter your name here

Latest article