9

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

 2 years ago
source link: https://computingforgeeks.com/install-oracle-java-13-on-ubuntu-debian/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Install Oracle Java 13 on Ubuntu 20.04/18.04/16.04 & Debian 10/9
Search

How to Install Oracle Java 13 on Ubuntu 20.04/18.04/19.04/16.04 & Debian 10/9/8?. Java is a popular programming language created in 1995 and used for developing mobile, web and Desktop Applications among many others. JDK 13 is an open-source reference implementation of version 13 of the Java SE Platform as specified by by JSR 388 in the Java Community Process. It is available for general use in Production environments.

For CentOS / Fedora, refer to: How To Install Oracle Java 13 (OpenJDK 13) on CentOS 7/8 & Fedora 31/30/29

The Java Platform lets you develop and deploy Java applications on servers, desktops and IoT devices. This short guide will cover the steps required to Install Oracle Java 13 on Ubuntu 20.04/18.04/16.04 & Debian 10/9. To be specific, the OpenJDK 13 or Java SE Development Kit 13.

Option 1: Install OpenJDK 13 on Ubuntu 20.04/18.04/16.04 & Debian 10/9

Visit JDK 13 releases page to download the latest archive.

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

Extract downloaded file using tar command.

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

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 your profile file and check java command

source /etc/profile.d/jdk13.sh

Confirm Java 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)

Option 2: Install Java SE Development Kit 13 on Ubuntu 20.04/18.04/16.04 & Debian 10/9

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

Update your list of packages and install wget.

sudo apt update
sudo apt -y install wget

Download Java SE Development Kit 13.

 wget --no-check-certificate -c --header  "Cookie: oraclelicense=accept-securebackup-cookie" "https://download.oracle.com/otn/java/jdk/13.0.2+8/d4173c853231432d94f001e99d882ca7/jdk-13.0.2_linux-x64_bin.deb"

If curl doesn’t work for you, download the package manually from Oracle Downloads page. Then install it using dpkg command.

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

For any dependency errors, resolve with the command:

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

To check if you have Java installed on your machine, type the following 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)

Test Java Installation

Create a HelloWorld Java program.

$ 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 your Java program.

$ java HelloWorld
Hello, World

Java Learning courses:

Recommended Books:

Best Books for Learning Java Programming

More how to guides:

How to set default Java version on Ubuntu / Debian

Set JAVA_HOME on CentOS / RHEL / Fedora

How to Install Apache Hadoop / HBase on Ubuntu 18.04

How to Install Java 8 on Ubuntu 18.04/16.04

How to Install Apache Hadoop / HBase on CentOS 7


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK