CentOS install JDK using Yum or up2date


In order to build the Linux environment conveniently and quickly, I have these words

  1. CentOS install JDK using Yum or up2date
  2. CentOS install Tomcat
  3. CentOS installation nginx
  4. CentOS install MySQL

1. View system version command

cat /etc/issue

2. View the version of JDK included in Yum or up2date

Yum search java or Yum list Java*
edition jre jdk
1.8 java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64
1.7 java-1.7.0-openjdk.x86_64 java-1.7.0-openjdk-devel.x86_64
1.6 java-1.6.0-openjdk.x86_64 java-1.6.0-openjdk-devel.x86_64

3. Install JDK
Select java-1.8.0-openjdk-devel.x86 this time_ 64 : OpenJDK Development Environment

yum install java-1.8.0-openjdk-devel.x86_64

4. Configure global variables

Open the configuration file and press insert to enter the editing mode

vi  /etc/profile

Copy the following three lines into the file, press ESC to exit the editing mode, enter: WQ save exit (the java_home here is subject to its own actual directory)

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin

Global variables take effect immediately

source  /etc/profile

5. Check whether the JDK installation was successful

java -version