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

Installing JAVA on ubuntu can be done using following easiest command. for ubuntu 16.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:
ca-certificates-java default-jdk-headless default-jre default-jre-headless fonts-dejavu-extra java-common libgif7 libice-dev libpthread-stubs0-dev libsm-dev libx11-6 libx11-dev libx11-doc libxau-dev
libxcb1-dev libxdmcp-dev libxt-dev openjdk-8-jdk openjdk-8-jdk-headless openjdk-8-jre openjdk-8-jre-headless x11proto-core-dev x11proto-input-dev x11proto-kb-dev xorg-sgml-doctools xtrans-dev

 $ java -version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-1ubuntu0.16.04.1-b13)
OpenJDK Server VM (build 25.181-b13, mixed mode)

Leave a Comment