Home » Development and Build » Development Environment Setup » How to Install Java using apt-get command on Ubuntu ?

How to Install Java using apt-get command on Ubuntu ?

Installing JAVA on ubuntu can be done using following easiest command. for Ubuntu 20.04, this command installs OpenJDK 8 as we can see details in additional packages installed.

$ sudo apt-get install default-jdk 

The following additional packages will be installed:

The following additional packages will be installed:
  default-jdk-headless default-jre default-jre-headless
The following NEW packages will be installed:
  default-jdk default-jdk-headless default-jre default-jre-headless

Now, you can check the version of JAVA installed on your Ubuntu.

$  java -version
openjdk version "1.8.0_275"
OpenJDK Runtime Environment (build 1.8.0_275-8u275-b01-0ubuntu1~18.04-b01)
OpenJDK 64-Bit Server VM (build 25.275-b01, mixed mode)

2 thoughts on “How to Install Java using apt-get command on Ubuntu ?”

Leave a Comment