1. Install Java JDK on CentOS

1. Download the installation package

    Address: http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz

2. Create a directory

    mkdir /opt/tools

    switch directory

    cd /opt/tools

3. Upload and download files to the directory of the server

4. Unzip

    tar -zxvf jdk-8u171-linux-x64.tar.gz

5. Transfer directory

    cp -r jdk1.8.0_171 /usr/local

6. Edit the configuration file

    vi /etc/profile

    Add the following code at the end

    export JAVA_HOME=/usr/local/jdk1.8.0_171local

    export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

    export PATH=$JAVA_HOME/bin:$PATH

    wq! Enter to save and exit

7. Make it effective

    source /etc/profile

8. Verify

    java -version




Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324613096&siteId=291194637