How to Install Java on Linux Mint

In this article, we will explain how to install Java on Linux Mint.

1. Introduction

Java is the most popular programming language of all due to its platform independence nature and versatile features such as OOPS, Multi-threading, Multitasking, concurrent programming, and many more. In this tutorial, we are going to see how we can install Java on the Linux Mint flavor of OS. Hence if you are having a Linux Mint version installed in your computer you could go through the following steps to install Java in it and make it ready for all types of Java programming. Java comes in 3 different editions i.e.

Moreover it is available in 2 diffferent implementations i.e.

Before we install Java, we should also be familiar with the following two terms in context to the Java Technology :

2. Prerequisite

You should have a non-root user account in your Linux mint System with Sudo privileges before proceeding with the installation.

3. Steps to install Java on Linux Mint 20 Ulyana

3.1 Install Open JDK 10

Currently, Open JDK 10 is the default version of Java for Linux Mint 19. To install the same please follow the given steps:

3.1.1 Package manager index

Update the package manager index typing the following command:

sudo apt update

The following image depicts the output after running the sudo apt update command.

Fig. 1 sudo apt update

3.1.2 Install the default Open JDK on Linux Mint 19

sudo apt install default-jdk 

The following figure depicts the output after running the command sudo apt install default-jdk

Figure 2. sudo apt install default-jdk

The following figure depicts the output after running the command suso apt install default-JDK

Figure 3. sudo apt install default-jdk

3.1.3 Confirm the installation

java -version
Output
openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10+post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-oubuntu120.04, mixed mode, sharing)
Figure 4. Output for java -version

3.2 Installing specific version of Open JDK

3.2.1 Put the version no. to install a specific version of open JDK:

sudo apt install openjdk-[version no.]-jdk

For. e.g. if you wish to install the OpenJDK version 8, which is the default LTS version of the OpenJDK, you need to run the following command:

sudo apt install openjdk-8-jdk
Figure 5. Output for sudo apt install openjdk-8-jdk_final

3.3 Installing Oracle Java with apt

Oracle Java which is the official version of Java from Oracle can be installed by following the below steps:

3.3.1 Adding the “Linux Uprising” PPA

sudo add-apt-repository ppa:linuxuprising/java

The following figure depicts the output after running the command sudo-apt-repository ppa:linuxuprising/java

Figure 6. sudo add-apt-repository ppa:linuxuprising/java

3.3.2 Download all the package information and apply updates and patches

sudo apt-get update

The following figure depicts the output after running the command Sudo apt update command

Fig. 7 sudo apt update command

3.3.3 Install the Oracle Java 14 from the Oracle official website and set it as default

sudo apt-get install oracle-java14-installer oracle-java14-set-default

The following figure depicts the output after running the command sudo apt-get install oracle-java14-installer oracle-java14-set-default

Figure 8. sudo apt-get install oracle-java14-installer oracle-java14-set-default

The following figure depicts the output after running the command sudo apt-get-install oracle-java14-install oracle-java14-set-default

Figure 9. sudo apt-get install oracle-java14-installer oracle-java14-set-default

Accept the License Agreement by clicking on the ok and yes button on the respective windows.

Figure 10. Oracle Java 14 License Agreement Window
Figure 11. Oracle Java 14 License Agreement Window

After accepting the License Agreement Page, finish with the rest of the installation.

The following figure depicts the output after running the command sudo apt-get install oracle-java14-installer oracle-java14-set-default

Figure 12. Output for command sudo apt-get install oracle-java14-installer oracle-java14-set-default

The following figure depicts after running the command sudo apt-get install oracle-java14-install oracle-java14-installer oracle-java14-set-default

Figure 13. Output for command sudo apt-get install oracle-java14-installer oracle-java14-set-default

The following figure depicts the output after running the command sudo apt-get install oracle-java14-installer oracle-java14-set-default

Figure 14. sudo apt-get install oracle-java14-installer oracle-java14-set-default

4. Summary

In this tutorial, we understood how to install the Java development kit, both Open JDK and Oracle Java version, in Linux Mint 20 Ulyana version.

You can also check the following articles:

Exit mobile version