Install jdk on centos7

Source: Internet
Author: User

Install jdk on centos7

1. Download jdk

Http://www.oracle.com/technetwork/Java/javase/downloads/jdk8-downloads-2133151.html

(Based on the number of digits in the operating system, select the corresponding version, 32-bit select x86, 64 select x64)

2. Upload to centos

2.1 install the upload tool lrzsz and run yum install lrzsz on the command line.

2.2 cd to the uploaded destination directory

2.3 run rz on the command line and select the tar package downloaded in step 1.

2.4 decompress the file to/usr/local/

2.5 switch to the decompressed directory, pwd

3. The above path will be used as the value of the JAVA_HOME environment variable and configured to/etc/profile

Vi/etc/profile

In normal mode, press G to jump to the end of the file, and press o to add the following two lines

Export JAVA_HOME =/usr/local/jdk1.8.0 _ 121
Export PATH = $ PATH: $ JAVA_HOME/bin

The effect is as follows:

4. Execute source/etc/profile to refresh the environment variable you just set to the current shell.

Here, I will post the source explanation below man.

Man source

4.1 check whether the environment variables take effect

Echo $ JAVA_HOME

Echo $ PATH

5. check whether it is successful

Java-version

The configuration is OK.

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.