1. Download jdk1.8 installation package Download https://pan.baidu.com/s/1p4yhTuupd-ZwUONizCXhXQ
2. Download the jdk-8u162-linux-x64.tar.gz uploaded to Linux, here I used VMware virtual machine installed Ubuntu. Under good tool installation tool directly downloaded jdk dragged into the home directory in Linux
3. Create under / usr / lib folder jvm
mkdir -p /usr/lib/jvm
4. jdk-8u162-linux-x64.tar.gz extract to / usr / lib / jvm
cd ~
sudo tar -zxvf ./jdk-8u162-linux-x64.tar.gz -C /usr/lib/jvm
5.cd /usr/lib/jvm
Use ls View
6. Configure environment variables (here I install directory is / usr / lib / jvm, if you install a different directory, change to the directory of your installation when configuring environment variable)
cd ~
vim ~/.bashrc
In the beginning of the file add the following lines of code
export JAVA_HOME=/usr/lib/jvm/jdk3.8.0_162
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
7. Use source ~ / .bashrc effective immediately
8. Use java -version see if installed (if real information that the installation configuration)