Install Oracle java 8 on Linux Mint/Ubuntu

      open your terminal and run the following commands.
  1. Add the PPA
          sudo add-apt-repository ppa:webupd8team/java

     2. Then update 
          sudo apt update

    3. Run java8 installer
          sudo apt install oracle-java8-installer

          Accept the licence agreement to proceed with installation.
          Finally check the java version by typing
          java -version
    4. To set environment variables automatically 
        sudo apt install oracle-java8-set-default