Issue
My Ubuntu machine have installed both java 1.7 and 1.8. But when I checked Java version it shows version Java 1.7 as the snapshot below. When I check Java alternative version I can see "java-8-openjdk-amd64". I am beginner to Ubuntu. Can anyone help me to change it to 1.8?
Solution
you can set the envirnoment variable to java 1.8 using this method Edit the /etc/profile
sudo gedit /etc/profile
Add these lines in the end
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH
like mentioned in this answer
How to set Java environment path in Ubuntu
Answered By - Ranger