Install java in CentOS 6.5

Source: Internet
Author: User

Install java in CentOS 6.5

1. First, prepare the JDK installation package. My download is jdk-7u79-linux-x64.tar.gz.
2. (follow these steps to access the root permission) create a Java folder under/usr/local.

mkdir /usr/local/java

3. decompress the file in your directory and move it to the java directory.

tar -zxvf jdk-7u79-linux-x64.tar.gzmv jdk1.7.0_79 /usr/local/java

4. Go to the etc directory and find the profile file for editing.

  cd /etc   vi profile

5. Enter edit mode and enter the bottom of the file.

export JAVA_HOME=/usr/local/java/jdk1.7.0_79/export JRE_HOME=${JAVA_HOME}/jre  export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib  export PATH=${JAVA_HOME}/bin:$PATH

6. After the input is complete, wq exits.
Input in/etc

source profile

Make the file take effect or in another directory
source /etc/profile
7. Verify that java-version appears.
Java version "1.7.0 _ 79"
Java (TM) SE Runtime Environment (build 1.7.0 _ 79-b15)
Java HotSpot (TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
The installation is successful.

The test is available. If there is a problem, it is usually caused by a problem when writing the path to the profile. You can modify the path based on your copy path.

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.