Replace the version of the selected software with the Linux Alternatives command

Source: Internet
Author: User

Last week when installing the search engine Elasticsearch, asked to install a newer version of Java, I chose Java 1.8.0, the installation of Java after the successful use of java-version found that the version is still 1.6.0,

Some information was queried to find that the version of the selected software could be replaced with the Linux Alternatives command.

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

A: First look at the current version of Java

II: Install Java 1.8.0 using the Linux Alternatives command

1. First use alternatives to see which Java versions are present in the system

Alternatives--config Java

2. Install Java 1.8.0 using the alternatives command

Alternatives--install/usr/bin/java Java/usr/local/java/jre1.8.0_131/bin/java 4

Explain:

/usr/bin/java is the path to the Java command, viewed with which Java, corresponding parameters <link>

Java corresponding parameters <name>

/usr/local/java/jre1.8.0_131/bin/java corresponds to <path>, the path of the Java command that represents java1.8.0

The number 4 corresponds to parameter <priority> because there are already 3 programs available in Java, so write 4

3. Use Alternatives--config Java to view the installation of Java 1.8.0 successfully

The red line of Java is what I just installed, indicating that the installation was successful

Three: Select Java version

Alternatives--config Java

See the results as in two (3), note the last sentence in English: Enter to keep the current selection[+], or type selection number, translate comes to press the ENTER key to save the currently selected [+], Or fade-in selection number. I typed the number 4 to indicate that I chose to use Java 1.8.0

Four: Use Java-version to view the selected version

Replace the version of the selected software with the Linux Alternatives command

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.