Download the latest JDK from http://www.java.com

Add the following lines to the /etc/profile file, please note you need to update the path of the JDK folder

JAVA_HOME=/usr/local/java/jdk1.8.0_92
JRE_HOME=$JAVA_HOME/jre
LARAVEL_HOME=/root/.config/composer/vendor/bin
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$LARAVEL_HOME
export JAVA_HOME
export JRE_HOME
export LARAVEL_HOME
export PATH

Now inform the system where java is installed

sudo update-alternatives –install “/usr/bin/java” “java” “/usr/local/java/jdk1.8.0_92/jre/bin/java” 1

Inform your Ubuntu Linux system that Oracle Java JDK/JRE must be the default Java

sudo update-alternatives –set java /usr/local/java/jdk1.8.0_92/jre/bin/java

And you are set to use the JDK

Adding JAVA JDK to Ubuntu in simple steps

Leave a Reply