10

Please check the scenario below:

sudo update-alternatives --config java
There are 5 choices for the alternative java (providing /usr/bin/java).
Selection            Path                                        Priority   Status
    0            /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java   1071      auto mode
    1            /opt/java/jdk1.8.0_25/bin/java                  1         manual mode
  * 2            /usr/lib/jvm/java-1.8.25-i386/bin/java          1         manual mode
    3            /usr/lib/jvm/java-1.8.25-i386/bin/javac         1         manual mode
    4            /usr/lib/jvm/java-1.8.25-i386/bin/javaws        1         manual mode
    5            /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java   1071      manual mode

echo $JAVA_HOME
/opt/java/jdk1.8.0_25/bin/java

OK, It's really messed up!! I need to clean and remove absolutely everything from the start !

I tried

sudo update-alternatives --remove "java" "/opt/java/jdk1.8.0_25-i386/bin/java"

but the table shown above remained unaltered !!

Please help me out !!!!

1 Answer 1

8

Could you please try to run with arguments without quotes? It works in my case:

svyatoslav@svyatoslav-DNS:~$ sudo update-alternatives --config java
[sudo] password for svyatoslav: 
Есть 4 варианта для альтернативы java (предоставляет /usr/bin/java).

  Выбор   Путь                                        Приор Состояние
------------------------------------------------------------
  0            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      автоматический режим
  1            /usr/bin/gij-4.9                                 1049      ручной режим
  2            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      ручной режим
  3            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      ручной режим
* 4            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1069      ручной режим

Нажмите enter, чтобы сохранить текущий выбор[*], или введите выбранное число: 
svyatoslav@svyatoslav-DNS:~$ sudo update-alternatives --remove java /usr/bin/gij-4.9
svyatoslav@svyatoslav-DNS:~$ sudo update-alternatives --config java                 
Есть 3 варианта для альтернативы java (предоставляет /usr/bin/java).

  Выбор   Путь                                        Приор Состояние
------------------------------------------------------------
  0            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      автоматический режим
  1            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      ручной режим
  2            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      ручной режим
* 3            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1069      ручной режим
6
  • Thanks!! it worked after removing the quotes :) I have managed to remove 1, 2, 3 and 4 in my table(see original post).
    – Codistan
    Apr 24, 2015 at 4:47
  • But echo $JAVA_HOME still shows /opt/java/jdk1.8.0_25. How can I change it?
    – Codistan
    Apr 24, 2015 at 5:01
  • Did you selected new alternative manually after removing old one? Apr 24, 2015 at 11:59
  • @CodePshyco please note, this variable can be set manually in your .bashrc or .profile. Check this answer: stackoverflow.com/questions/6477415/… Apr 24, 2015 at 12:28
  • I selected alternative 0 (openjdk). I removed the rest except 5 which seems identical to 0 but mode is manual and couldn't be removed.
    – Codistan
    Apr 24, 2015 at 12:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .