# Eclipse Temurin JDK 21 ubuntu 安装

**URL:** <https://www.isharkfly.com/t/eclipse-temurin-jdk-21-ubuntu/18670>\
**Category:** 程序语言\
**Tags:** java\
**Created:** [February 20, 2026, 4:51pm UTC](https://www.isharkfly.com/t/eclipse-temurin-jdk-21-ubuntu/18670 "2026-02-20T16:51:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hex](https://www.isharkfly.com/user_avatar/www.isharkfly.com/hex/32/21953_2.png) [@hex](https://www.isharkfly.com/u/hex)\
**Post date:** [February 20, 2026, 4:51pm UTC](https://www.isharkfly.com/t/eclipse-temurin-jdk-21-ubuntu/18670/1 "2026-02-20T16:51:51Z")

</div>

命令行工具为：

```auto
root@ns524146:~# apt install temurin-21-jdk

```

 ![2026-02-20_11-50-32](https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/3X/c/3/c3085db3bf8c97dc7dc4f267271a30614b390361.jpeg)

## 选择版本

运行下面的命令来选择需要的版本。

```auto
sudo update-alternatives --config java

```

通过移动上下键盘即可。

```auto
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/temurin-21-jdk-amd64/bin/java 2111 auto mode
  1 /usr/lib/jvm/temurin-17-jdk-amd64/bin/java 1711 manual mode
  2 /usr/lib/jvm/temurin-21-jdk-amd64/bin/java 2111 manual mode

Press <enter> to keep the current choice[*], or type selection number: ^C

```

选择后回车。
