1。从java.net下载openjdk10
wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" \https://download.java.net/java/GA/jdk10/10.0.2/19aef61b38124481863b1413dce1855f/13/openjdk-10.0.2_linux-x64_bin.tar.gz
2.解压到/usr/local下
tar zxf openjdk-10.0.2_linux-x64_bin.tar.gz -C /usr/local
3.将目录换名(也可以不换)
mv /usr/local/jdk-10.0.2 /usr/local/jdk-10
4.维护链接(后面2是编号,根据实际情况修改)
alternatives --config java --查看编号alternatives --install /usr/bin/java java /usr/local/jdk-10/bin/java 2 alternatives --set java /usr/local/jdk-10/bin/java alternatives --install /usr/bin/javac javac /usr/local/jdk-10/bin/javac 2 alternatives --set javac /usr/local/jdk-10/bin/javac alternatives --install /usr/bin/jar jar /usr/local/jdk-10/bin/jar 2 alternatives --set jar /usr/local/jdk-10/bin/jar