I need help in understanding the following parameters

"/usr/bin/java" "java" ""/usr/java/latest/bin/java" 1

in the following command.

update-alternatives --install "/usr/bin/java" "java" ""/usr/java/latest/bin/java" 1

I understand you are telling your system to have another java version it can use.


Why is there a "java" in quotes, and what is the purpose of the 1?

  • 1
    Where did you pull this usage from exactly? – Ramhound Mar 24 '15 at 18:24
  • an internal documentation – HSV Mar 24 '15 at 18:31
  • Please provide a more detailed response than "internal documentation" I don't know if your talking about internal documentation within Oracle or something else. – Ramhound Mar 24 '15 at 18:37

Why is there a "java" in quotes

To quote the Ubuntu man page this text is the "name," which "is the name of its symlink in the alternatives directory." In other words this is so when you type java (or whatever text you choose) in the terminal it knows you are looking for this particular link.

what is the purpose of the 1?

Again from the man page this is the "priority" which is used for the following purpose - "when a link group is in automatic mode, the alternatives system ensures that the links in the group point to the highest priority alternative appropriate for the group." In other words if a decision needs to be made as to which link is used, the numerically higher value wins out. I suspect however it may be inconsequential, by using update-alternatives you are switching the default from "automatic" to "manual" in which case I don't think it applies. But I am no expert.

There is a useful post from William DeMeo for background.

| improve this answer | |

from http://linux.die.net/man/8/update-alternatives :

update-alternatives --install link name path priority

Will update answer later with explanation of "alternatives" in linux.

| improve this answer | |

If you run command :

$man update-alternatives


alternatives [options] --install link name path priority [--slave link name path]... [--initscript service]

The java means that want to update java with a priority on either 1, 2, 3, etc.

You need to mention the path and all parameters in the given order above.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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