Linux `alternatives --config` without user input

Solution 1:

Does your version have --set?

--set name path
Set the program path as alternative for name. This is equivalent to --config but is non-interactive and thus scriptable.

Solution 2:

You can use alternatives --auto <name> to automatically select the highest priority option.

An example:

 alternatives --install  /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/javac javac /usr/java/latest/bin/javac 10
 alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 20
 alternatives --auto javac

Would select the higher priority version (20) /usr/java/latest/bin/javac