0

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?

enter image description here

2 Answers2

2

sdkman is a good Open source version manager for Java. It provides commands to search & install multiple versions of Java and switch between versions with

sdk use java 1.8.363-open

It can also manage other tools like Maven.

Anil
  • 329
  • 2
  • 9
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

How to set Java environment path in Ubuntu

Ranger
  • 96
  • 1
  • 2