1. Prepare the jdk installation file;
Here I am using jdk-7u79-linux-x64.tar.gz
2. Create the sotfware directory in the /usr/local directory and upload the JDK file;
Unzip the file and modify the folder to javajdk.
tar -zxvf jdk-7u79-linux-x64.tar.gz;
mv jdk-7u79-linux-x64.tar.gz javajdk;
into the folder.
3. Configure environment variables (the most important step)
Edit the configuration file: vim /etc/profile and add the following configuration variables
JAVA_HOME=/usr/local/software/javajdk
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/tools.jar
export PATH JAVA_HOME CLASSPATH
The build environment is as follows:
hold and exit.
4. Verify the environment
java -version
echo $JAVA_HOME
So far, the JDK installation in the Linux CentOS6.9 environment is successful!