ubuntu 16.04 手动安装Java过程

4 篇文章 0 订阅

参考:
https://www.vultr.com/docs/how-to-manually-install-java-8-on-ubuntu-16-04

所需Java软件包https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
在这里插入图片描述
下载对应版本,到用户根目录下的Downloads

sudo mkdir /usr/lib/jvm
cd /usr/lib/jvm
sudo tar -xvzf ~/Downloads/jdk-8u192-linux-x64.tar.gz
sudo vim /etc/environment

内容替换成:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/jdk1.8.0_192/bin:/usr/lib/jvm/jdk1.8.0_192/db/bin:/usr/lib/jvm/jdk1.8.0_192/jre/bin"
J2SDKDIR="/usr/lib/jvm/jdk1.8.0_192"
J2REDIR="/usr/lib/jvm/jdk1.8.0_192/jre*
JAVA_HOME="/usr/lib/jvm/jdk1.8.0_192"
DERBY_HOME="/usr/lib/jvm/jdk1.8.0_192/db"

# sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_192/bin/java" 0
# sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_192/bin/javac" 0
# sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0_192/bin/java
# sudo update-alternatives --set javac /usr/lib/jvm/jdk1.8.0_192/bin/javac
update-alternatives --list java
update-alternatives --list javac
java -version

出现:
java version “1.8.0_192”
Java™ SE Runtime Environment (build 1.8.0_192-b12)
Java HotSpot™ 64-Bit Server VM (build 25.192-b12, mixed mode)
6.

javac -version

出现:
javac 1.8.0_192

成功!

END

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值