i tried to install java using the following :

apt install default-jre  

but when i want to see the version using :

java -version 

it says :

apt install default-jre              # version 2:1.11-72, or
apt install openjdk-11-jre-headless  # version 11.0.8+10-0ubuntu1~20.04
apt install openjdk-8-jre-headless   # version 8u265-b01-0ubuntu2~20.04
apt install openjdk-13-jre-headless  # version 13.0.3+3-1ubuntu2
apt install openjdk-14-jre-headless  # version 14.0.1+7-1ubuntu1

i run the installation command again it again :

Reading package lists... Done
Building dependency tree       
Reading state information... Done
default-jre is already the newest version (2:1.11-72).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

and when i try to run the following :

sudo update-alternatives --config java

i got this :

There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-11-openjdk-amd64/bin/java
Nothing to configure.
update-alternatives: warning: forcing reinstallation of alternative /usr/lib/jvm/java-11-openjdk-amd64/bin/java because link group java is broken
update-alternatives: warning: not replacing /usr/bin/java with a link

and the same keep happening over and over .

i had no problems during installation and all ok when i run a program that depend on java or run the java -version it is not working .



Problem was solved by going to the path:


and there i found a file with the name


removing the java folder form there fixed the issue and now everything is ok .


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.