Oracle Java installation on Ubuntu 20.04 Focal Fossa Linux - LinuxConfig.org

In this tutorial we will perform an installation of Oracle Java SE Development Kit on Ubuntu 20.04 Focal Fossa Desktop/Server.
This is a companion discussion topic for the original entry at https://linuxconfig.org/oracle-java-installation-on-ubuntu-20-04-focal-fossa-linux

After issuing
“sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-14/bin/java 1”
I get this error,
“update-alternatives: error: alternative path /usr/lib/jvm/jdk-14/bin/java doesn’t exist”

Hi Motashim_Al_Razi,

Welcome to our forums.

I would start on two paths to solve your issue. First, the package may not installed properly. You can check if this is so with an apt query:

$ sudo apt list --installed | grep jdk

If the package is installed, you should find jdk-14 in the output of the above command.

My next approach would be simple filesystem path related: maybe your downloaded package is of a higher version of the JDK, so the filesystem path differs. I checked the vendor’s site, and if I would like to download Oracle JDK 14, I get a package called jdk-14.0.1_linux-x64_bin.deb (note the difference with the minor version as opposed to the package name in the tutorial).

If that’s the case, you can find the actual path of your java and javac binary with something like:

$ ls -al /usr/lib/jvm/jdk-14*

With that, you can change the actual command you need with update-alternatives to point to your java binaries with correct path.

Hi
Thank you very much for your kind reply. My mistake was that I installed jdk 13.2. I installed jdk 14 now. It has been resolved.
Thanks again.

1 Like