In this How to Guide we are going see the Method to Install Install Oracle Java on Ubuntu 16.04 and 17.04

Install Oracle Java on Ubuntu

  • Update the Packages
sudo apt-get update
  • Install JRE
sudo apt-get install default-jre
  • Now Install Oracle Java via PPA
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
  • Install Oracle JDK 8 Pack
sudo apt-get install oracle-java8-installer
  • Verify your Install
java -version

itrendbuzz-orjdk1

  • Setup a path for $JAVA_HOME and $JRE_HOME
nano .bashrc
  • it will open the .bashrc file
  • Next, add this below lines on the .bashrc file & save it
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export JRE_HOME=/usr/lib/jvm/java-8-oracle/jre
  • Reload the .bashrc file
source ~/.bashrc
  • Verify your setup
$JAVA_HOME
$JRE_HOME

itrendbuzz-orjdk2

  • That's all done