I have recently installed the environment, and I often do this repeatedly. It is a pity that the DOCKER environment has not been fully deployed and promoted. If the DOCKER suit is done well in the future, there will be no need to engage in these mechanical labors!
decompress
#tar zxvf jdk-8u91-linux-x64.tar.gz
Move the package to /usr/local/java
#mv jdk1.8_91 /usr/local/java/jdk1.8_91
Edit the linux configuration file
#vi ~ / .bashrc
export JAVA_HOME=/usr/local/java/jdk1.8.0_91 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
If you encounter vi prompt :set noreadonly
to unset the readonly flag.
Just :set noreadonly
Make the configuration take effect
#source ~/.bashrc
verify
#java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)