Catalog
JDK installation and deployment
I. software version
- JDK version: jdk-7u79-linux-x64.tar.gz
- Other:
Linux Distribution: CentOS-7-x86_64-DVD-1804.iso
FTP Tools: FileZilla_3.32.0-rc1_win64-setup.exe
II. JDK installation
-
Current installation path (/ usr/local/java)
-
Decompression JDK
# tar -zxvf jdk-7u79-linux-x64.tar.gz
- Open configuration environment variable
- Open / etc/profile
# vim /etc/profile
- In the last line, add the following configuration (JAVA_HOME needs to be modified according to the situation)
######################################### #jdk environment variable configuration ######################################### export JAVA_HOME=/usr/local/java/jdk1.7.0_79 export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/tools.jar export PATH=$PATH:${JAVA_HOME}/bin
- Make jdk configuration of / etc/profile file effective
#source /etc/profile or. / etc/profile
- Check whether the jdk is installed successfully
# java -version
- Success prompt:
[comuser@localhost jdk1.7.0_79]$ java -version 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)
3. Uninstall openjdk
- If the prompt message is:
comuser@localhost java]$ java -version openjdk version "1.8.0_161" OpenJDK Runtime Environment (build 1.8.0_161-b14) OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode) [comuser@localhost java]$
openjdk needs to be uninstalled here. The steps are as follows:
- View openjdk version
# yum list installed | grep java
- Uninstall according to openjdk version
#--Uninstall openjdk 1.7 # yum -y remove java-1.7.0-openjdk.x86_64 # yum -y remove java-1.7.0-openjdk-headless.x86_64 #--Uninstall openjdk 1.8 # yum -y remove java-1.8.0-openjdk.x86_64 # yum -y remove java-1.8.0-openjdk-headless.x86_64
- Re check whether the jdk is installed successfully
#--Re validate the jdk configuration of the / etc/profile file # source /etc/profile #--Query jdk version # java -version