linux:ubuntu21.04安装java se 16(jdk 16.0.2)
一,jdk16下载:
1,jdk官网:
https://www.oracle.com/java/
2,jdk下载地址:
https://www.oracle.com/cn/java/technologies/javase-downloads.html
3,下载:
点击 JDK Download进入下载链接地址:如图:
选择 jdk-16.0.2_linux-x64_bin.tar.gz 这个包下载,如图:
弹出下载链接地址时,选中 同意技术许可协议,如图:
下载完成后,移动到 /usr/local/source目录
说明:刘宏缔的架构森林是一个专注架构的博客,
网站:https://blog.imgtouch.com
本文: https://blog.imgtouch.com/index.php/2023/05/27/linux-ubuntu21-04-an-zhuang-java-se-16-jdk-16-2/
对应的源码可以访问这里获取: https://github.com/liuhongdi/
说明:作者:刘宏缔 邮箱: 371125307@qq.com
二,安装jdk:
1,解压:
root@lhdpc:/usr/local/source# tar -zxvf jdk-16.0.2_linux-x64_bin.tar.gz
2,把解压后的jdk目录,移动到安装目录/usr/local/soft目录下:
root@lhdpc:/usr/local/source# mv jdk-16.0.2 /usr/local/soft/
三,配置jdk:
1,编辑profile文件,把命令保存到文件中
root@lhdpc:/usr/local/source# vi /etc/profile
在末尾处添加以下命令:
export JAVA_HOME=/usr/local/soft/jdk-16.0.2 export CLASSPATH=.:$JAVA_HOME/lib export PATH=$PATH:$JAVA_HOME/bin
2,使变量生效:
root@lhdpc:/usr/local/source# source /etc/profile
四,测试java 16的安装效果
root@lhdpc:/usr/local/source# java --version java 16.0.2 2021-07-20 Java(TM) SE Runtime Environment (build 16.0.2+7-67) Java HotSpot(TM) 64-Bit Server VM (build 16.0.2+7-67, mixed mode, sharing)
五,查看linux的版本:
root@lhdpc:/usr/local/source# more /etc/os-release NAME="Ubuntu" VERSION="21.04 (Hirsute Hippo)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 21.04" VERSION_ID="21.04" 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" VERSION_CODENAME=hirsute UBUNTU_CODENAME=hirsute