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.