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

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.