1. Select the corresponding javaJDK version
1. Jdk download address
(jdk1.6 +)
(jdk1.7 +)
http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html
(jdk1.8 +)
http://www.oracle.com/technetwork/java/javase/downloads/index.html
2. Select the bin file to install, or you can choose the way to decompress the compressed package
#set java environment
JAVA_HOME=/jdk/jdk1.6.0_38
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME CLASSPATH PATH
export JAVA_HOME
export PATH
export CLASSPATH
save and exit
Note: It has been verified that the 1.6+ version is still low, and it needs to be adjusted to the 1.7+ version by itself.
Summary of common commands during installation
********************View jdk installation results
java -version
********************View the current jdk versionrpm -qa|grep java
echo $JAVA_HOME
**************** ****View java installation path
find / -name java
********************View java execution path
which java
*********** *********Uninstall redundant versions
For example:
uninstall the following jdk information
java-1.6.0-openjdk-1.6.0.41-1.13.13.1.el6_8.x86_64
tzdata-java-2016c-1.el6.noarch
command:
rpm -e --allmatches --nodeps java-1.6.0-openjdk-1.6.0.41-1.13.13.1.el6_8.x86_64
rpm -e --allmatches --nodeps tzdata-java-2016c-1.el6.noarch
Reference documentation:
1. Authorization explanation http://blog.csdn.net/wlwh90/article/details/53129315