Update-alternatives command

Source: Internet
Author: User


View the location of the Java command

Find the soft link location for/etc/alternatives/java

It allows us to see all the optional commands for a command. Execute code:

There are two types of alternative: automatic and manual. The initial state of each alternative is automatic, and if the system discovers that the administrator has manually modified a alternative, its status is automatically changed to manual

View the current Java version

My JDK is in this file.

Set the default JDK
sudo update-alternatives--install/usr/bin/java Java/usr/lib/jvm/jdk1.7.0_67/bin/java 300
sudo update-alternatives--install/usr/bin/javac Javac/usr/lib/jvm/jdk1.7.0_67/bin/javac 300

Alternatives--install < links > < name > < path > < priority >
Update-alternatives--install Link name path priority [--slave link name path] ...
Link for the system in the same function of the software's public link directory, such as/usr/bin/java (need absolute directory);
Name is a command-link character, such as Java;
Path is the directory where you want to use the new command, the new software;
Priority is precedence, which is higher than the current value when the command link already exists, because the link of priority high is enabled by default when alternative is auto mode;
# 17067 Priority set based on version number (change priority needs to be greater than current)


See if there is Java optional on this machine. Use the following command here
$ sudo update-alternatives--list java


The config option function selects a system default for the existing command link
Use the syntax for:
Update-alternatives--config Name
Here is the focus of the configuration version, when there are multiple versions of the system, you can set the default version by this command, similar to the default program
The asterisk indicates the current system is used, and the plus sign indicates the highest priority. Enter a value to modify the default configuration and press ENTER to keep the original state.

Remove plus command plus path to remove links


Update-alternatives command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.