Red Hat under alternatives command usage

Source: Internet
Author: User
Alternatives is a powerful command under Linux. Can only be performed under root permissions. If there are several commands in the system that are very similar, but cannot be deleted at will, then you can use alternatives to specify a global setting.

Alternatives is often used to install multiple versions of the same software in the same system. For example, in order to develop the need, I need to install JDK1.4.2, but also need 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 ways for you.

The alternatives command line executes as follows:
[Root@localhost 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 priority

In the case of Java installation, my Fedora 8 has two versions of Java, 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 installed the Java version "1.4.2_19" in the directory/TOOLS/JDK
[Root@localhost test]# Alternatives--install/usr/bin/java Java/tools/jdk/bin/java 3
[Root@localhost test]# Alternatives--config java

There are 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 the directory/tools/jdk6
[Root@localhost test]# Alternatives--install/usr/bin/java Java/tools/jdk6/bin/java 4
[Root@localhost test]# Alternatives--config java

There are 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

With Alternatives--config Java, you can choose the Java version you want.


Source

Related Article

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.