Ubuntu16.04安装JDK18.12

前端之家收集整理的这篇文章主要介绍了Ubuntu16.04安装JDK18.12前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1. 从 Oracle 官网 (http://www.oracle.com/technetwork/Java/javase/downloads/jdk8-downloads-2133151.html)下载 JDK:jdk-8u112-linux-i586.tar.gz

2. 解压JDK文件到新建目录

tar -xzvf jdk-8u112-Linux-i586.tar.gz

cp -R jdk1.8.0_112/ ../install/java

3. 设置环境变量:

#set Java environment
export JAVA_HOME=/home/nick/install/java/jdk1.8.0_112
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

4. 设置默认JDK

sudo update-alternatives --install /usr/bin/java java /home/nick/install/java/jdk1.8.0_112/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /home/nick/install/java/jdk1.8.0_112/bin/javac 300

5.验证

java -version

原文链接:https://www.f2er.com/ubuntu/355405.html

猜你在找的Ubuntu相关文章