linux(ubuntu21.10):安装jdk-17(java 17.0.3.1)
一,下载安装包:
地址:
https://www.oracle.com/java/technologies/downloads/#java17
我们选择x86 Compressed Archive包下载
下载完成后,把安装包移动到/usr/local/source
说明:刘宏缔的架构森林是一个专注架构的博客,
网站:https://blog.imgtouch.com
本文: https://blog.imgtouch.com/index.php/2023/06/01/ubuntu21-10-linux-an-zhuang-jdk17-java-17-3-1/
对应的源码可以访问这里获取: https://github.com/liuhongdi/
或: https://gitee.com/liuhongdi
说明:作者:刘宏缔 邮箱: 371125307@qq.com
二,安装jdk17
1,解压:
root@lhdpc:/usr/local/source# tar -zxvf jdk-17_linux-x64_bin.tar.gz
2,移动到安装目录:
root@lhdpc:/usr/local/source# mv jdk-17.0.3.1/ /usr/local/soft/
3,编辑配置文件:
root@lhdpc:/usr/local/source# vi /etc/profile
添加如下内容:
export JAVA_HOME=/usr/local/soft/jdk-17.0.3.1 export CLASSPATH=.:$JAVA_HOME/lib export PATH=$PATH:$JAVA_HOME/bin
4,使配置生效:
root@lhdpc:/usr/local/source# source /etc/profile
三,测试效果:
root@lhdpc:/usr/local/source# java --version java 17.0.3.1 2022-04-22 LTS Java(TM) SE Runtime Environment (build 17.0.3.1+2-LTS-6) Java HotSpot(TM) 64-Bit Server VM (build 17.0.3.1+2-LTS-6, mixed mode, sharing)
四,查看linux版本:
liuhongdi@lhdpc:~/work$ more /etc/os-release PRETTY_NAME="Ubuntu 21.10" NAME="Ubuntu" VERSION_ID="21.10" VERSION="21.10 (Impish Indri)" VERSION_CODENAME=impish ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=impish