1. Download the corresponding version of Java SE
2. Unzip to the appropriate directory
1 tar -xvf jdk.*.*.tar.gz
3. Environment configuration
1 vim ~/ .bashrc 2 3 #JAVA 4 export JAVA_HOME=$HOME/Java/ jdk1.8 .0_161/ 5 export JRE_HOME=$JAVA_HOME/ jre 6 export PATH=$JAVA_HOME/bin:$JRE_HOME/ bin:$PATH 7 export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:.(<-- note that this '.' is very important, it means the current directory) 8 9 After exiting: 10 source ~/.bashrc
You can view the path represented by dir $HOME
JAVA_HOME, JRE_HOME combined with its own path