To install jdk we need some commands.
These are all three commands we will need to install jdk.
so,  just copy and paste these commands in the TERMINAL

#sudo apt-add-repository ppa:webupd8team/java
#sudo apt-get update
#sudo apt-get install oracle-java8-installer

Then ensure your JAVA_HOME variable has been set to:
export JAVA_HOME=/usr/lib/jvm/java-8-oracle

For Detailed information Watch the Video