下载openjdk
http://jdk.java.net/15/
解压
sudo mkdir /usr/lib/jvm
sudo tar -xzvf openjdk-15.0.2_linux-x64_bin.tar.gz -C /usr/lib/jvm
设置环境变量
vim ~/.bashrc
# 追加下面的内容
export JAVA_HOME=/usr/lib/jvm/jdk-15.0.2
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
验证
source ~/.bashrc
java -version