JDK,Java Development Kit contains JRE and development tools. It physically exists unlikely JVM. It contains the software and tools that you need to execute,compile and debug java program.In this blog, we’ll look in the installations for open jdk and oracle jdk in linux through terminal.
Before java installation,check if java is existing or not by a command
java -version
Installation Steps of open-jdk 8
– Open a terminal with the keys Ctrl+Alt+T and type a command to add ppa.

sudo add-apt-repository ppa:openjdk-r/ppa
– We need to update system to acknowledge ppa the command is
    sudo apt-get update
– The installation command is
   sudo apt-get intsall openjdk-8-jdk
– Then,after installation of jdk,we need to update the system by following this command.
   sudo apt-get update
It might take few minutes.
– Check the version for java again for the confirmation
   java -version
Installing Oracle JDK 8
– open a terminal and use this command to add java ppa.
  sudo add-apt-repository ppa:webupd8team/java
– After adding ppa,system requires updation.The updation command is
  sudo apt-get update
– Then finally installation command is as follows:
  sudo apt-get install oracle-java8-installer
–¬† Check the version for java again for the confirmation
   java -version
Environment Variable Set Up
For setting the environment variables, follow up this blog  Setting JAVA_HOME . This Blog has a detailed description on how to set up environment variables.
Happy Programming !!