update-alternatives: "alternative path doesn't exist" issue while updating JDK7
Solution 1
It's my epic fault! :)
I mixed up the arguments of update-alternatives
. The right command line must be:
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk/bin/java 1
Solution 2
Since you are updating from a previous Java version, which you have removed manually, you would have to execute the following command twice. You get an error message the first time and it works when you execute it the second time.
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk/bin/java" 1
Source: Easy Linux Project
Related videos on Youtube
ezze
Updated on September 18, 2022Comments
-
ezze over 1 year
I decided to update my JDK7 to recent version from here.
Corresponding x64 tag.gz archive for my architecture has been downloaded and extracted to
/usr/lib/jvm
as usual. All previous versions of Java were installed before the same way. But before setting new alternatives forjava
,javac
andjavaws
I removed all existing alternatives using the following commands:sudo update-alternatives --remove-all java sudo update-alternatives --remove-all javac sudo update-alternatives --remove-all javaws
Now when trying to install new alternatives I get the following:
sudo update-alternatives --install /usr/lib/jvm/jdk1.7.0_13/bin/java java /usr/bin/java 1 update-alternatives: error: alternative path /usr/bin/java doesn't exist.
Of course,
/usr/bin/java
doesn't exist but/usr/bin
does? What's wrong with it and how can I fix it?-
Admin about 11 yearsThere is a webupd8 java ppa for updating the Oracle JDK7.
-
-
ezze about 11 yearsThanks for the anwser but the issue is that I mixed up update-alternatives's arguments. The right command works with the first attempt.
-
ezze about 11 yearsI posted it as answer 'cause it solved the question. I don't know for sure whether I should delete the question (as it solved by myself in short time) or post the answer.
-
Nathan J.B. about 11 yearsPosting the answer is generally the right thing. Though, this problem is so localized, I'm not sure anyone will find it useful in the future. Who knows, I could be wrong. :)