Under centos7 installation jdk8

  1. Download the corresponding jdk uploaded to the server
  2. To extract the installation directory
tar -zxvf jdk-8u231-linux-x64.tar.gz
  1. Rename & delete archive
rm jdk-8u231-linux-x64.tar.gz 
mv jdk-8u231 jdk1.8
  1. Editing environment variable configuration file
vi /etc/profile
  1. Add at the end:
# java env setting
export JAVA_HOME=/opt/jdk1.8
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
  1. Validate the configuration
source /etc/profile  
  1. Verification, the version number appears successful
java -version

Guess you like

Origin www.cnblogs.com/jenkins/p/12228546.html