Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I typed:

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/ jdk1.8.0/bin/java" 1

It's says alternatives --install needs link name path priority

share|improve this question
What are you typing exactly? please be careful with any punctuation (e.g. dashes) and spaces – steeldriver Jul 5 '14 at 16:42
@steeldriver could you explain link name path priority . If there were no link like "/user/bin/java/" then will erroneous result? – Swapnil Jul 5 '14 at 16:53
It should create the link (and the name if there is no current java group in /etc/alternatives). AFAIK the only thing that must pre-exist is the path component i.e. /usr/lib/jvm/jdk1.8.0/bin/java - but note that (as posted in your question) you have a space in yours - hence my 1st comment. – steeldriver Jul 5 '14 at 16:58
@steeldriver yeah /usr/lib/jvm/bin/java/ is available . I've try sudo update-alternatives -- install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0.05/bin/java" 1 – Swapnil Jul 5 '14 at 17:22
Are you leaving a space between the -- and the word install? if so, don't - it needs to be --install. Also the quotes should not be necessary, just sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0.05/bin/java 1 – steeldriver Jul 5 '14 at 17:35
up vote 17 down vote accepted

Are you leaving a space between the -- and the word install? if so, don't - it needs to be --install

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0.05/bin/java 1

The quotes should not be necessary since none of the elements have embedded spaces - although they shouldn't do any harm.

share|improve this answer

This is beacause this command maintains symbolic links. I recommend to execute man update-alternatives to get more information about the command.

share|improve this answer

Just trying to contribute with this post. I use this command, once that I know my setup correctly.

echo 1 | sudo update-alternatives --config java
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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