How to use sudo update-alternative for java installation on Ubuntu 18.04?

I am trying to install Oracle JDK on ubuntu 18.04.

I am using the command sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-14.0.2/bin/java 1 but this command does nothing. But it works perfectly for javac.

enter image description here

Can anyone can throw some light on this?

Thanks!

0

1 Answer

Ater installing the new java, you would need to make it the java pointed to by /usr/bin/java, by typing

update-alternatives --config java

and then select the new java as the one to use. Apparently you did not previously have another version of javac installed, so the new javac was selected automatically...

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like