Saturday, October 31, 2020

Install Java on Debian 9 Operating System

Must read

How to Setup a Firewall with UFW on Ubuntu 20.04

Nowadays, a Firewall is an essential utility and property of any system for security; by default Ubuntu Operating system having a firewall...

How to Install Ruby on Ubuntu 20.04 Linux

Nowadays, Ruby is the most popular language, especially for SaaS application development. It has a perfect and elegant syntax structure, and it...

How to Install Eclipse IDE on Ubuntu 20.04 Linux

Eclipse is the most famous and widely used Java integrated development environment (IDE). It supports many plugins to enhance the capabilities to...

The 30 most useful Linux commands

This article will introduce some practical and common Linux or Unix command , which is the Linux system administrators normally use the command . This article is not a...
SATISH KUMAR
I am Satish Kumar, Founder of LinuxConcept. Linux and F.O.S.S enthusiast, love to work on open source platform and technologies.
- Advertisement -

Java is the most popular programming language, use to build various type of applications like a desktop application, web application, mobile application, etc.

The Java comes in two different packages, one is Java Runtime Environment (JRE), and another one is the Java Development Kit (JDK).

- Advertisement -

When we need to run a Java-based application or java program, we need only Java Runtime Environment, but if you want to develop Java application, you need to Java Development Kit (JDK). JDK includes both JRE and debugging tools and development libraries.

Java also has two different flavors, one is Open JDK, and another one is Oracle Java, both have the same functionalities and capabilities, the only difference is Oracle Java has some more commercial features. The default Java flavor of Linux Operating System is OpenJDK.

If you are a little bit confuse to choose between OpenJDK and Oracle Java, you can stick with default OpenJDK available on Debian 9.

In this tutorial article, we will walk through the Java installation process on Debian 9 machine.

Prerequisites

Before continuing this tutorial, make sure you have Debian 9 installed machine and a user to login into the system with sudo privileges.

OpenJDK 8 installation

- Advertisement -

OpenJDK 8 is available in Debian 9 Operating system as a default JDK.

To install Java on Debian 9 machine using OpenJDK 8, use the following command:

$ sudo apt update
$ sudo apt install default-jdk

After completion of JDK installation you can verify it by checking the version of Java, as shown below:

$ sudo java –version
- Advertisement -

If OpenJDK installed you will get the output like below image:

Now OpenJDK 8 is installed successfully into your Debian 9 machine.

OpenJDK 11 Installation

The latest version of Java 11 is not available with default repository of Debian 9 operating system. The OpenJDK 11 is available with Backports repository of Debian.

To install OpenJDK into Debian machine first need to add backport repository by using below command:

$ echo 'deb http://ftp.debian.org/debian stretch-backports main' | sudo tee /etc/apt/sources.list.d/stretch-backports.list

After adding the repository, update the apt repository package list and install OpenJDK 11 by using the following command:

$ sudo apt update
$ sudo apt install openjdk-11-jdk

Oracle Java Installation

First, you should be aware of Oracle Java Licence; it is free only for non-commercial use of the software like development and personal use.

To install Oracle Java 11, you should use Linux Uprising PPA.

You can follow below steps to install Oracle 11 on Debian 9.

Step 1 – Install dependencies

First, you should install Oracle Java 11 dependencies into the system by using the following command:

$ sudo apt install dirmngr gnupg

Step 2 – Import PPA key and enable the repository

To import PPA public key and enable the repository for Oracle Java 11 use below command:

$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 73C3DB2A
$ echo 'deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main' | sudo tee /etc/apt/sources.list.d/linuxuprising-java.list

Step 3 – Install Oracle Java 11

Once the repository is added and enable, you are ready to install Oracle Java 11.

Now you can update the repository package list and install Java by using the following command:

$ sudo apt update
$ sudo apt install oracle-java11-installer

You will get the screen to accept Oracle license, accept and Java will install.

Step 4 – Verify Java Installation

After installation of java you can verify by checking the version of Java, as shown below:

$ java –version

Java default version Setup

If you have installed multiple Java into your Debian machine, you can check the default version of Java by checking the version, as shown below:

$ java -version

The output of the above command will look like below image:

You can change the default Java version by using update-alternatives command, as shown below:

$ sudo update-alternatives --config java

You will get the list of all installed Java version on your Debian machine, Enter the number of the version you want to use as a default and press Enter button.

Java Uninstall

If you want to remove Java package from your Debian system, you can uninstall it like any other application with the apt package manager.

To uninstall OpenJDK grom your Debian machine you can use below command:

$ sudo apt remove default-jdk

Conclusion

Now you have learned how to install Java on Debina 9 Operating System. Now you can install any java either OpenJDK or Oracle Java on Debian operating system.

- Advertisement -
- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Subscribe to our newsletter

To be updated with all the latest news, offers and special announcements.

Latest article

How to Setup a Firewall with UFW on Ubuntu 20.04

Nowadays, a Firewall is an essential utility and property of any system for security; by default Ubuntu Operating system having a firewall...

How to Install Ruby on Ubuntu 20.04 Linux

Nowadays, Ruby is the most popular language, especially for SaaS application development. It has a perfect and elegant syntax structure, and it...

How to Install Eclipse IDE on Ubuntu 20.04 Linux

Eclipse is the most famous and widely used Java integrated development environment (IDE). It supports many plugins to enhance the capabilities to...

The 30 most useful Linux commands

This article will introduce some practical and common Linux or Unix command , which is the Linux system administrators normally use the command . This article is not a...

How to Reset the MySQL Root Password

Do you want to reset the MySQL root password? Sometimes we forget the root password and not able to log in on...