The alternatives command (man page) is a tool to create, remove, maintain and display information about the symbolic links comprising the alternatives system. So, you make system-wide changes with it and, thus, you need a user with elevated privileges. You either have to sudo update-alternatives (if sudo is installed and the user is a sudoer) or login as root with su - and then run said command. This answer to a question about how one runs commands that need root permissions may be helpful to you.
Alternatives not working well for Java installation on Centos 6.4 - Unix & Linux Stack Exchange
c++ - How to use update-alternatives in centos? - Stack Overflow
java - /usr/bin/alternatives command throws usage error - Stack Overflow
java - sudo: update-alternatives: command not found - Stack Overflow
It appears than the option --list doesn't take arguments, it's a bug in the manual synopsis.Moreover for manage my java versions I should try env variables.
(The bug has been reported as https://github.com/fedora-sysv/chkconfig/issues/11)
Use this command alternatives --list to get available versions on cli.
[root@88a15b43eab2 /]# alternatives --list
ld auto /usr/bin/ld.bfd
libnssckbi.so.x86_64 auto /usr/lib64/pkcs11/p11-kit-trust.so
jre_openjdk auto /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el7_9.x86_64/jre
java auto /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el7_9.x86_64/jre/bin/java
jre_1.8.0_openjdk auto /usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.342.b07-1.el7_9.x86_64
jre_1.8.0 auto /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el7_9.x86_64/jre
Add python2.6 to alternatives:
sudo alternatives --install /usr/bin/python python /usr/local/bin/python2.6 5
Then set python3.9 as defaut:
sudo alternatives --config python
Or override the symlink with the desired python version:
sudo ln -fs /usr/bin/python3.9 /usr/bin/python
Late to the party but to me the good practice for this is to run
sudo alternatives --install /usr/bin/python3 python3 /bin/python3.9 99
Since you are trying to update the alternatives for python 3.x version it makes sense to use the python3 link instead of the python one.
After installing the alternative, configure it with:
sudo alternatives --config python3
And in the end:
sudo alternatives --config python
To configure the python link to point to python3 using alternatives
I was trying to set the java path while installation of Glassfish on Ubuntu 14.04.
The command goes like in CentOS as
" alternatives --install /usr/bin/java java /opt/java/jdk/bin/java 1"
“alternatives --config java”
Well, the problem is that in Ubuntu the “alternative” command does not work.
So, what can be done regarding this ?
Alternatives just makes symbolic links I believe - Assumption based on this:
linux.die.net
alternatives(8) - Linux man page
alternatives creates, removes, maintains and displays information about the symbolic links comprising the alternatives system.
Thus manually create symbolic links:
ln -s /path/to/file /path/to/symlink
How does that apply to your problem? I’m not exactly sure but I feel like you just want to add /usr/bin/java to the path variable. Which can be found here bash - Permanent PATH variable - Ask Ubuntu