亲宝软件园·资讯

展开

Ubuntu 16.04 安装 java 8 Ubuntu 16.04 安装 java 8的方法

dsczijizuo 人气:0

1. 下载 java

离线下载

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie” “http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz"

转载自: https://blog.csdn.net/dandan920107/article/details/94398465

2. 解压

将下载的 jdk-8u141-linux-x64.tar.gz 拷贝致 opt 目录

mkdir /opt/java/
cd /opt/
tar -zxvf jdk-8u141-linux-x64.tar.gz -C java

3. 创建软连接

cd /bin
sudo ln -s /opt/jdk1.8.0_141/bin/java java

3. 配置环境变量

sudo vi /etc/profile

在最后加入

export JAVA_HOME=/opt/java/jdk1.8.0_141
export PATH=${JAVA_HOME}/bin:${PATH}

保存退出, 最后使之生效

source /etc/profile

4. 验证

java -version

结果:

java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode)

附录:下面看下wget下载java8离线安装包 for linux

wget --no-cookies --no-check-certificate --header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie” “http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz”

总结

加载全部内容

相关教程
猜你喜欢
用户评论