Services and User Management

A Debian administrator extracts a JDK to /opt/jdk-21 and wants the system to manage it as a candidate for the generic name java, using the link /usr/bin/java and a priority of 2100. Which command registers it?

Show the answer

Correct answerD. update-alternatives --install /usr/bin/java java /opt/jdk-21/bin/java 2100

--install takes the link, the generic name, the real path and the priority, in that order. Swapping the link and name is the tempting mistake and makes the command fail. --set only selects an already registered alternative and takes no priority.