Sample with maven
update-alternatives --install /usr/bin/mvn maven /opt/maven/apache-maven-3.8.7/bin/mvn 0
update-alternatives --config maven