Centos7 Installing the Java Runtime Environment

Source: Internet
Author: User

1. Detect if there is a relevant historical version

Shell:java-version

1.1, there are related openjdk and other versions of the SDK needs to be deleted.

View details, Command Window input, SHELL:RPM-QA | grep java

Command description

RPM Management Suite

-qa use Inquiry mode to query all packages

Grep finds eligible strings in a file

Java finds files that contain Java strings

Delete Related superfluous commands

RPM-E--nodeps java-1.7.0-openjdk-1.7.0.111-2.6.7.8.el7.x86_64

RPM-E--nodeps java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64

RPM-E--nodeps java-1.8.0-openjdk-headless-1.8.0.102-4.b14.el7.x86_64

RPM-E--nodeps java-1.7.0-openjdk-headless-1.7.0.111-2.6.7.8.el7.x86_64

Command description

RPM Management Suite

-e Delete the specified package

--nodeps does not verify the correlation of the suite files

Or remove by yun-y Remove related command

Re-detect the historical version; Shell:java-version command not found appears, the removal is successful.

1.2, prompt command not found no historical version, then ignore 1.1 content.

2. Create the local Java environment directory under the Linux environment Shell:mkdir/usr/java

3. Download SDK for Windows environment and upload via XFTP

This installation is Java 1.8 for Linux 64:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

4, installed in the Windows environment XFTP5, has been installed please ignore directly. Protocol Select SFTP, port number 22, method Select Password, enter the relevant user name and password and connect.

: Link: Https://pan.baidu.com/s/1SU_mTG9AkjvZ-7VJ6FSWxg Extract code: 3AP2

Upload local file to Centos7 server, directory/usr/java file name: jdk-8u171-linux-x64.tar.gz

Then decompression, SHELL:TAR-ZXVF jdk-8u131-linux-x64.tar.gz, decompression can delete the compressed package file. Shell:rm-f jdk-8u171-linux-x64.tar.gz

5. Configure the Java Runtime environment variable Shell:vim/etc/profile Press A to enter insert mode, and enter the following command at the end of the file content:

Export java_home=/usr/java/jdk1.8.0_171
Export classpath=.: $JAVA _home/jre/lib/rt.jar: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export path= $PATH: $JAVA _home/bin

Press the ESC key, exit edit mode, and enter SHELL::WQ to save the exit.

Refresh file, Shell:source/etc/profile

Execute the Java View Version command again, and the following shell:java-version appears to install successfully.

Other Park friends articles: https://www.cnblogs.com/chy123/p/6750351.html

Centos7 Installing the Java Runtime Environment

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.