update-alternatives --install says it needs link name path priority?

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


Solution 1:

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.

Solution 2:

The command sintax is

sudo update-alternatives --install <link> <name> <path> <priority>

if there are no space in the parameters, you don't need quotes.

In your case:

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

Pay attention: did you really have a space in the path before jdk?