8 C
Texas

How To Install Java 14 on Ubuntu / Debian

Today we are going to learn that how to install Java 14 on Ubuntu 18.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.

Here are some methods that we’ll use to install Java on our system.

  • By installing Oracle Java SE Development Kit 14
  • Installing from PPA Repository
  • By installing manually

We will cover all of these methods so you can install easily by choosing your preferred one.

Step 1: Installing Oracle Java SE Development Kit 14

You can download the Debian package of Java 14 at Java SE Development Kit official page. If you want to download it manually, simply run the command with wget & curl.

- Advertisement -

So, as usual we do, update your system and install wget and curl.

sudo apt update 
sudo apt -y install wget curl

After installing these, pull the Java SE Development Kit 14 Debian package by running the below command.

wget --no-check-certificate -c --header  "Cookie: oraclelicense=accept-securebackup-cookie" "https://download.oracle.com/otn-pub/java/jdk/14+36/076bab302c7b4508975440c56f6cc26a/jdk-14_linux-x64_bin.deb"

Output:

jdk-14_linux-x64_ 100%[=============>] 157.91M   955KB/s    in 3m 14s  
2020-03-30 02:15:10 (835 KB/s) - ‘jdk-14_linux-x64_bin.deb’ saved [165583792/165583792]

Now, with the help of apt install the DEB package by typing

sudo apt install ./jdk-14_linux-x64_bin.deb

And then press Y when prompted to continue. You’ll see the similar output on successful installation.

sudo apt install ./jdk-14_linux-x64_bin.deb
Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting 'jdk-14' instead of './jdk-14_linux-x64_bin.deb'
The following NEW packages will be installed:
jdk-14
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/166 MB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 /home/sabi/jdk-14_linux-x64_bin.deb jdk-14 amd64 14-1 [166 MB]
Selecting previously unselected package jdk-14.
(Reading database … 121590 files and directories currently installed.)
Preparing to unpack …/sabi/jdk-14_linux-x64_bin.deb …
Unpacking jdk-14 (14-1) …
Setting up jdk-14 (14-1) …
sabi@Ubuntu-18:~$

After it set the Java Environment Variables to use it in command line operation.

cat <<EOF | sudo tee /etc/profile.d/jdk14.sh
export JAVA_HOME=/usr/lib/jvm/jdk-14
export PATH=$PATH:$JAVA_HOME/bin
EOF

Now, source the file by

source /etc/profile.d/jdk14.sh

Then verify the installation by running java -version command.

Output:

sabi@Ubuntu-18:~$ java -version
java version "14" 2020-03-17
Java(TM) SE Runtime Environment (build 14+36-1461)
Java HotSpot(TM) 64-Bit Server VM (build 14+36-1461, mixed mode, sharing)

Step 2:Installing Java 14 from PPA Repository

In first step we installed the Java by using Java 14 SE Development Kit. Now, we will use the PPA repository to install Java 14 on our system. As the Java binaries are being available on the PPA repository, so we’ll add the repo with the help of given command.

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

Then install the Oracle Java 14 using the below command

sudo apt -y install oracle-java14-installer

Then accept the licence, and digital technology license agreement when prompted.

how to install java 14 on Ubuntu / Debian

You can also set it to the default by installing the following package.

sudo apt -y install oracle-java14-set-default

Verify the installation by running the java -version command

java -version

After it set up the Java Environment Variables.

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

Now, source the file

source /etc/profile.d/jdk.sh

Step 3: Installing Java 14 Manually

Install the Java 14 manually using the curl command. You can also download the package from the download page.

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

Once the package is downloaded, extract it

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

Then move the output to the /opt directory

sudo mv jdk-14 /opt/

And after it set up the Java environment.

sudo tee /etc/profile.d/jdk14.sh <<EOF
export JAVA_HOME=/opt/jdk-14
export PATH=$PATH:$JAVA_HOME/bin
EOF

Then source the file.

source /etc/profile.d/jdk14.sh

Verify the installtion

$ echo $JAVA_HOME
/opt/jdk-14

$ java -version
openjdk version "14" 2020-03-30
OpenJDK Runtime Environment (build 14+36-1461)
OpenJDK 64-Bit Server VM (build 14+36-1461, mixed mode, sharing)

So, this is how you can Install the Java on your Ubuntu/Debian system or server.

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

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article