Score:0

Install and set Path for Oracle Java JDK 16 on Ubuntu 20.04

pr flag

I have installed Oracle JDK 16 on Ubuntu 20.04. I have downloaded the tar.gz file and installed it using the ubuntu software installer and its confirmed to be installed in the ubuntu software center.

Using "java" in the terminal returns "command not found".

I assume the path is not set correctly. I set the path according to this: https://java.tutorials24x7.com/blog/how-to-install-java-16-on-ubuntu-20-04-lts

However my JDK got installed in "/usr/lib/jvm/jdk-16.0.1"

So I added

JAVA_HOME=/usr/lib/jvm/jdk-16.0.1 PATH=$PATH:$HOME/bin:$JAVA_HOME/bin export JAVA_HOME export PATH

to my /etc/profile

I am but still getting "Command 'java' not found".

Any Ideas, what I did wrong?

in flag
Silly question, but have you reloaded your profile since adding the path? You can do this by closing and re-opening Terminal
MrTony avatar
pr flag
"Unfortunately" yes I did. I even did a full restart without any result.
Knud Larsen avatar
by flag
Please go to section '# Configure Java Alternatives' https://java.tutorials24x7.com/blog/how-to-install-java-16-on-ubuntu-20-04-lts and do the two install commands .... and finally, if required, the --config command : To select version.
MrTony avatar
pr flag
This solved it, thank you!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.