Linux CentOS 6.5 uses your own JDK to modify environment variables

Source: Internet
Author: User

First of all, the default JDK means that after we install the CentOS system comes with the JDK, download and install the JDK itself only need to download, unzip, then the steps are consistent with this article

1. View the location of our default JDK

Instructions:

[HTML]View PlainCopy
    1. which Java

Let's go check it out. Discovery is a hyperlink, continue tracking

hyperlinks, Instructions:

[HTML]View PlainCopy
    1. Ls-lrt

Keep tracking.

There's a JDK, let's go check it out.

We found the initial jdk1.7 position (i.e. the system current JDK), and we needed the location of the jdk1.6 version, that is, jre-1.6.0-openjdk.x86_64, recorded

/usr/lib/jvm/jre-1.6.0-openjdk.x86_64

2. Modifying environment variables

Instructions:

[HTML]View PlainCopy
    1. Vim/etc/profile

In this position I append:

[HTML]View PlainCopy
    1. Export java_home=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64
    2. Export path= $PATH: $JAVA _home/bin
    3. Export classpath=.: $JAVA _home/lib/tools.jar: $JAVA _home/lib/dt.jar

Press ESC to enter: Wq Save and exit

Make environment variables effective

[HTML]View PlainCopy
    1. Source/etc/profile

Update JDK

[HTML]View PlainCopy
    1. Update-alternatives--install/usr/bin/java Java/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java 300
    2. Update-alternatives--install/usr/bin/javac Javac/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/javac 300
    3. Update-alternatives--install/usr/bin/jar Jar/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/jar 300
    4. Update-alternatives--config Java

Select the same name, enter the subscript

Test it.

directive: Java-version

found that the JDK version has been modified

Linux CentOS 6.5 uses your own JDK to modify environment variables

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.