How to install OpenJDK 13 on Ubuntu 19

Install OpenJDK 13 on Ubuntu 19

In this tutorial, I will show you how to install OpenJDK 13 on Ubuntu 19. The Java Development Kit (JDK) is a software development environment used for developing Java applications and applets. It includes the Java Runtime Environment (JRE), an interpreter/loader (java), a compiler (javac), an archiver (jar), a documentation generator (Javadoc) and other tools needed in Java development.

1. Pre-requisites

  • Ubuntu 19  installed with root access

Read Also: Install postgreSQL 11 on Debian 10 (Buster)

Read Also: Install OpenJDK 8 on Ubuntu 16

Read Also: Install OpenJDK 13 on Mac 

Install OpenJDK 13 on Ubuntu

Here we will use apt to install Java 13 on Ubuntu 19

$ sudo apt install openjdk-13-jdk

2. Check java Version

Now after installing open JDK check the version using the following command

$ java -version
openjdk version "13" 2019-09-17
OpenJDK Runtime Environment (build 13+13-Ubuntu-0ubunt1)
OpenJDK 64-Bit Server VM (build 13+13-Ubuntu-0ubunt1, mixed mode, sharing)

Read Also: How to install Java 11 on CentOS 7

3. Set Java Home Environment

We need to set Java home Environment Variable in order to use java with some applications. Let’s get started.

$ sudo update-alternatives --config java
There are 2 choices for alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-13-openjdk-amd64/bin/java 1211 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode
2 /usr/lib/jvm/java-13-openjdk-amd64/bin/java 1211 manual mode

Option 1: Set Environment Variable

$ export JAVA_HOME=/usr/lib/jvm/java-13-openjdk-amd64/bin/java

$ echo $JAVA_HOME
/usr/lib/jvm/java-13-openjdk-amd64/bin/java

Option 2: Adding in .bash_profile

In this option, I will add an entry in .bash_profile.

$ vim ~/.bash_profile

add the following and save and quit.

$ export JAVA_HOME=/usr/lib/jvm/java-13-openjdk-amd64/jre/bin/java

Now source the file.

$ source ~/.bash_profile

Now check the Java Home

$ echo $JAVA_HOME
/usr/lib/jvm/java-13-openjdk-amd64/jre/bin/java

If you have any issues using this tutorial please feel free to comment below.

Source : OpenJDK

Leave a Reply

Your email address will not be published.


*