Linux Configuration JDK Environment variables

Source: Internet
Author: User

1. Search for and delete older versions of the JDK or openjdk under the CENTOS7 system, search instructions: RPM-QA | grep java

The removal instructions are:rpm-e--nodeps, such as: Rpm-e--nodeps java-1.7.0-openjdk-headless-1.7.0.71-2.5.3.1.el7_0.x86_64.

2. After removing the clean, right-click on the terminal under the folder of the Jdk-8u45-linux-x64.tar.gz installation package , then unzip the installation package to the specified folder.

The decompression instruction is:tar-zxvf jdk-8u45-linux-x64.tar.gz-c/usr/local

Here I unzipped the installation package under/usr/local 。注意-C,后面要添加路径 .

3. Set environment variables, the first is to open the folder setting environment variables, the instruction is:vim/etc/profile and then in the English input method to switch to the "insert" state , you can directly at the beginning of the "# will prevent the need For merging in the future updates. The following environment variables are configured under this line:

Export JAVA_HOME=/USR/LOCAL/JDK1.8.0_45 export JRE_HOME=/USR/LOCAL/JDK1.8.0_45/JRE export classpath=.: $JAVA _home/ Lib/dt.jar: $JAVA _home/lib/tools.jar: $JRE _home/lib: $CLASSPATH export path= $JAVA _home/bin: $PATH

Press ":: Wq" to save after exiting, enter directive:source/etc/profile The environment variable that is set to take effect.

4. Check if the installation is successful, enter the command:java-version , if the terminal appears

Java version "1.8.0_45" Java (tm) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot (tm) 64-bit Server VM (Build 25.4 5-B02, Mixed mode)

Indicates that the installation was successful.

Linux Configuration JDK Environment variables

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.