Alternatives is a powerful command under Linux. Can only be performed under root authority. If there are several command functions in the system that are very similar, but can not be arbitrarily deleted, then use alternatives to specify a global setting.
Alternatives is commonly used to install multiple versions of the same software on the same system. For example, in order to develop the need, I need to install JDK1.4.2, but also need to JDK1.6.10, how can I ignore the installation path, according to my own meaning, using the Java version I want it?
Here are one by one of your paths.
The alternatives command line executes as follows:
[Email protected] tools]# alternatives
Alternatives version 1.3.36-copyright (C) 2001 Red Hat, Inc.
This is freely redistributed under the terms of the GNU public License.
Usage:alternatives--install <link> <name> <path> <priority>
[--initscript <service>]
[--slave <link> <name> <path>]*
Alternatives--remove <name> <path>
Alternatives--auto <name>
Alternatives--config <name>
Alternatives--display <name>
Alternatives--set <name> <path>
Common options:--verbose--test--help--usage--version
--altdir <directory>--admindir <directory>
Description
Alternatives--install <link> <name> <path> <priority>
which
Install indicates installation
Link is a symbolic link
Name is the identifier
Path is the way to execute the file
Priority indicates precedence
As an example of Java installation, my Fedora 8 comes with two versions of Java, respectively, as follows:
Selection Command
-----------------------------------------------
* 1/usr/lib/jvm/jre-1.7.0-icedtea/bin/java
2/usr/lib/jvm/jre-1.5.0-gcj/bin/java
I have Java version "1.4.2_19" installed in directory/TOOLS/JDK
[Email protected] test]# Alternatives--install/usr/bin/java Java/tools/jdk/bin/java 3
[Email protected] test]# Alternatives--config java
There is 3 programs which provide ' Java '.
Selection Command
-----------------------------------------------
*+ 1/usr/lib/jvm/jre-1.7.0-icedtea/bin/java
2/usr/lib/jvm/jre-1.5.0-gcj/bin/java
3/tools/jdk/bin/java
Enter to keep the current selection[+], or type selection Number:3
I also installed the Java version "1.6.0_12" under Directory/tools/jdk6
[Email protected] test]# Alternatives--install/usr/bin/java Java/tools/jdk6/bin/java 4
[Email protected] test]# Alternatives--config java
There is 4 programs which provide ' Java '.
Selection Command
-----------------------------------------------
* 1/usr/lib/jvm/jre-1.7.0-icedtea/bin/java
2/usr/lib/jvm/jre-1.5.0-gcj/bin/java
+ 3/tools/jdk/bin/java
4/tools/jdk6/bin/java
Enter to keep the current selection[+], or type selection number:4
You can choose the Java version you want with alternatives--config java.
Linux Alternatives Command detailed