执行更新
$ sudo apt-get update
安装
sudo ap[t-get install openjdk-8-jdk
配置openJDK环境变量
sudo vi /etc/environment
加入下面值
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
JRE_HOME=${JAVA_HOME}/jre
CLASSPATH=.:JAVAHOME/lib:{JRE_HOME}/lib
PATH=JAVAHOME/bin:PATH
验证
注销重新登陆一下, 输入java -version
, 提示如下则成功
➜ ~ java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-1~deb9u1-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)