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

shareimprove 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

2 Answers

up vote 3 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.

shareimprove this answer
 

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

shareimprove this answer