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?
Asked
Active
Viewed 1,243 times
0
-
`$ sudo update-alternatives --config java` .... https://askubuntu.com/questions/315646/update-java-alternatives-vs-update-alternatives-config-java – Knud Larsen Nov 14 '21 at 07:56
-
What version of Ubuntu is this?! – Thorbjørn Ravn Andersen Nov 14 '21 at 08:59
2 Answers
1
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

Ranger
- 96
- 1
- 2