centos7 install jdk
Download jdk jdk-8u151-linux-x64.tar.gz and
put it in the /usr/local directory
Unzip the tar -zxvf jdk-8u151-linux-x64.tar.gz
Modify /etc/profile and add at the end of the file
JAVA_HOME=/usr/local/jdk1.8.0_151/
CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH=$PATH:$JAVA_HOME/bin
To make the above changes take effect, the command line executes source /etc/profile