Lately I have been solving some small and annoying issue but still couldn’t get a solution to this.
When i try to install openjdk-8-jdk (sudo apt install openjdk-8-jdk) this is what i get…
ndacyayisenga@ndacyayisenga-ThinkPad-S5-S540:~$ sudo apt install openjdk-8-jdk
[sudo] password for ndacyayisenga:
Reading package lists... Done
Building dependency tree
Reading state information... Done
openjdk-8-jdk is already the newest version (8u292-b10-0ubuntu1~20.04).
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
ndacyayisenga@ndacyayisenga-ThinkPad-S5-S540:~$
and when i do java -version
ndacyayisenga@ndacyayisenga-ThinkPad-S5-S540:~$ java -version
Command 'java' not found, but can be installed with:
sudo apt install openjdk-11-jre-headless # version 11.0.11+9-0ubuntu2~20.04, or
sudo apt install default-jre # version 2:1.11-72
sudo apt install openjdk-13-jre-headless # version 13.0.7+5-0ubuntu1~20.04
sudo apt install openjdk-16-jre-headless # version 16.0.1+9-1~20.04
sudo apt install openjdk-8-jre-headless # version 8u292-b10-0ubuntu1~20.04
sudo apt install openjdk-14-jre-headless # version 14.0.2+12-1~20.04
@ndacyayisenga in addition to jenv recommended you can also opt to use sudo update-alternatives --config java and then just select which java version you want to use .
Personally it works well for me to switch between java versions on my machine
@gcliff actually the problem I have is when i try to install java the machine tells me that java is already installed but when I try to check for the java version my machine doesn’t recorgnize java… @gcliff did u try to check through this below critically
Thats why am not even able to set the $PATH… Actually Java tells me its in the machine yet its not there… maybe any other i could install it woould help…
ndacyayisenga@ndacyayisenga-ThinkPad-S5-S540:~$ sudo apt install openjdk-8-jdk
[sudo] password for ndacyayisenga:
Reading package lists... Done
Building dependency tree
Reading state information... Done
openjdk-8-jdk is already the newest version (8u292-b10-0ubuntu1~20.04).
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
ndacyayisenga@ndacyayisenga-ThinkPad-S5-S540:~$
Thanks @gcliff… I was able to resolve this though the solution was so mechanical I just got a friend with java 1.8 and copied the java related files in their right path from his computer on a flash to mine. I just found out that many of them were missing and sudo apt install openjdk-8-jdk wasn’t downloading them