19.9 C
Texas

How To Install Oracle Java 13 on Ubuntu 18.04 / 16.04 & Debian 10 / 9

Java is a popular and well-known programming language used for developing mobile, web & Desktop Applications among many other features and developments. JDK 13 is an open source available for Public in Production environments. The Java Platform lets you develop & deploy java applications on servers, desktops & IoT devices. In this article you will cover the installation of Java 13 on Ubuntu 18.04.

Install OpenJDK 13 on Ubuntu 18.04 & Debian 10/9

To download the latest version of Java , go to the official release page of JDK 13.

sudo apt install -y curl
curl -O https://download.java.net/java/GA/jdk13/5b8a42f3905b406298b72d750b6919f6/33/GPL/openjdk-13_linux-x64_bin.tar.gz

Use tar command to extract the downloaded packages.

- Advertisement -
tar xvf openjdk-13_linux-x64_bin.tar.gz

Now, move the resulting folder to /opt directory.

sudo mv jdk-13 /opt/

Configure Java Environment

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

Source the file & check java command

source /etc/profile.d/jdk13.sh

Check the installed version.

$ echo $JAVA_HOME
/opt/jdk-13
$ java -version
openjdk version "13" 2019-09-17
OpenJDK Runtime Environment (build 13+33)
OpenJDK 64-Bit Server VM (build 13+33, mixed mode, sharing)

Installing Java SE Development Kit 13 on Ubuntu 18.04 /Debian 10/9

Java SE Development Kit contains set of tools required by Developers to write, compile, run and debug Java Applications.

Update lists & install wget

sudo apt update
sudo apt -y install wget

Now, download the Java SE Development Kit 13 by running

wget --no-check-certificate -c --header  "Cookie: oraclelicense=accept-securebackup-cookie" "https://download.oracle.com/otn-pub/java/jdk/13+33/5b8a42f3905b406298b72d750b6919f6/jdk-13_linux-x64_bin.deb"

In case, curl failed or unable to download the Java SE Development Kit 13, download the package manager manually from Oracle Downloads page. Then install it using dpkg command.

sudo dpkg -i jdk-13_linux-x64_bin.deb

Remove the dependency issue if occurs by

sudo apt -f install

Configure java environment.

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

Check if you have installed on your machine run the given command

$ source /etc/profile.d/jdk13.sh
$ java -version
java version "13-ea" 2019-09-17
Java(TM) SE Runtime Environment (build 13-ea+33)
Java HotSpot(TM) 64-Bit Server VM (build 13-ea+33, mixed mode, sharing)

Testing Java Installation

Write a simple program which will print “HelloWorld” in Java

$ cat HelloWorld.java 
public class HelloWorld {
public static void main(String[] args) { // Prints "Hello, World" to the terminal window. System.out.println("Hello, World"); }
}

Compile java code

javac HelloWorld.java

Run the program

java HelloWorld
Hello, World

- 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