去jdk下載頁面找到要下載的jdk,用wget下載html
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otnpub/java/jdk/8u131b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm
jdk12地址 https://download.oracle.com/otn-pub/java/jdk/12.0.2+10/e482c34c86bd4bf8b56c0b35558996b9/jdk-12.0.2_linux-x64_bin.rpm
rpm -ivh jdk-8u131-linux-x64.rpm
vim /etc/profile //打開環境變量文件
JAVA_HOME=/usr/java/jdk1.8.0_131 CLASSPATH=%JAVA_HOME%/lib:%JAVA_HOME%/jre/lib PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin export PATH CLASSPATH JAVA_HOME
source /etc/profile //從新載入
java -version
rpm -qa|grep jdk //查看版本 rpm -e jdk版本 //卸載