Linux|linux 安装jdk11

linux 安装jdk11

  1. 安装Java 11
sudo apt install openjdk-11-jdk

2.检查jdk版本
java -version

3.输出看起来像下面这样:
openjdk version "11.0.9.1" 2020-11-04 OpenJDK Runtime Environment (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04) OpenJDK 64-Bit Server VM (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)

4.配置环境变量
  1. 使用vim或vi指令打开profile文件:
vim /etc/profile

  1. 将以下代码粘贴进去:
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 CLASSPATH=$JAVA_HOME/lib PATH=$JAVA_HOME/bin:$PATH export PATH JAVA_HOME CLASSPATH

如果没有权限保存,执行下边名字输入密码即可

# :w ! sudo tee %

  1. 重新加载/etc/profile
source /etc/profile

查看Java版本:
java -versionopenjdk version "11.0.9.1" 2020-11-04 OpenJDK Runtime Environment (build 11.0.9.1+1-post-Uos-1deb10u2) OpenJDK 64-Bit Server VM (build 11.0.9.1+1-post-Uos-1deb10u2, mixed mode, sharing)

【Linux|linux 安装jdk11】查看gradle版本:
./gradle --versionBuild time:2021-08-17 09:59:03 UTC Revision:a773786b58bb28710e3dc96c4d1a7063628952ad Kotlin:1.5.21 Groovy:3.0.8 Ant:Apache Ant(TM) version 1.10.9 compiled on September 27 2020 JVM:11.0.9.1 (Uos 11.0.9.1+1-post-Uos-1deb10u2) OS:Linux 5.10.50-amd64-desktop amd64

    推荐阅读