0%

ubuntu升级java版本

java 升级java版本命令如下:

QQ群:397745473

当前版本信息

1
2
3
4
5
6
7
8
9
查java位置
root@v:~# whereis java
java: /usr/bin/java /usr/lib/java /usr/share/java /usr/share/man/man1/java.1.gz

查版本
root@v:~# /usr/bin/java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~18.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)

获取最新版本上传到服务器

1
2
下载地址:
https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html

解压并重新替换软链接

1
2
3
4
5
6
7
mkdir -p /opt/jdk
tar -zxf jdk-11.0.5_linux-x64_bin.tar.gz -C /opt/jdk/

rm -f /usr/bin/java /usr/bin/javac

ln -s /opt/jdk/jdk-11.0.5/bin/java /usr/bin/java
ln -s /opt/jdk/jdk-11.0.5/bin/javac /usr/bin/javac

确认升级成功

1
2
3
4
5
6
7
root@v:~# java -version
java version "11.0.5" 2019-10-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.5+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.5+10-LTS, mixed mode)

root@v:~# javac -version
javac 11.0.5

参考:

https://blog.csdn.net/keainanhaio/article/details/78659480

QQ群:397745473

欢迎关注我的其它发布渠道