How to Install Java Program in Ubuntu Linux Operating System

Posted on

This is an article written to demonstrate how to install Java Program in Ubuntu Linux operating system. Basically, there are two ways installing Java Program in Ubuntu Linux operating system in my opinion. Those two ways are :

1. Installing using software package management tools.

Depends on the operating system used, there are lots of software package management tools available in the context of Linux as the operating system. In case of Windows, it is much easier since the executable installer can be directly executed.  First of all, just check the Java program if there are available or enlisted by executing the command of ‘apt-cache’. Use the command and execute it in the command prompt as shown below :

apt-cache search 'java'

But it can actually searched by using this executed command :

apt-cache search 'jdk'

Below is the output generated most likely :

user@hostname:~$ apt-cache search 'jdk'
openjdk-8-jre-dcevm - Alternative VM for OpenJDK 8 with enhanced class redefinition
openjdk-8-jre-zero - Alternative JVM for OpenJDK, using Zero/Shark
openjdk-9-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-9-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-9-doc - OpenJDK Development Kit (JDK) documentation
openjdk-9-jdk - OpenJDK Development Kit (JDK)
openjdk-9-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-9-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-9-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-9-source - OpenJDK Development Kit (JDK) source files

After listing all the available Java program which can be installed, just execute the Java program using the following command in the command line :

apt-get -y install openjdk-9-jdk

So, if the above command has been successfully executed, the Java program installed can be checked by executing the program ‘apt list –installed | grep jdk’ as shown below :

user@hostname:~$ apt list --installed | grep jdk

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

openjdk-8-jre-headless/xenial-updates,xenial-security,now 8u171-b11-0ubuntu0.16.04.1 amd64 [installed,automatic]

There is a list of Java program installed which is ‘openjdk-8-jre-headless’. So, if there is a necessity for installing another version of Java, for an example Java JDK 9, just execute the above command using the appropriate name of the package as shown in the above.

2. Install Java program manually.

To install Java program manually, just download the zip compressed file of Java program from the official site which is providing Java program installation. After successfully downloading it, extract it and place it in the exact location. Another installation file type is also available such as executable installation based on Windows, rpm for Linux-based operating system and also in binary format. Just choose the suitable installation format based on needs and also the operating system used.

3 thoughts on “How to Install Java Program in Ubuntu Linux Operating System

Leave a Reply