1.从官网下载 jdk-8u191-linux-x64.tar.gz(https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html),放进download
2.解压并放入设定的文件夹内
cd /
sudo mkdir mySoftware
cd mySoftware
sudo mkdir java
cd /home/zwj/Downloads
tar -zxvf jdk-8u191-linux-x64.tar.gz
sudo mv jdk-8u191-linux-x64 /mySoftware/java
3.添加路径
sudo gedit ~/.bashrc
'''
#set Java environment
JAVA_HOME = /mySoftware/java
JRE_HOME = $JAVA_HOME/jre
PATH = $PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH = .:$JAVA_HOME/lib:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
'''
4.生效配置内容 source ~/.bashrc
5.重启terminal,java -version