Ubuntu 21.10にJava(OpenJDK)18をインストールする

環境

# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=21.10
DISTRIB_CODENAME=impish
DISTRIB_DESCRIPTION="Ubuntu 21.10"

OpenJDK18のインストール方法

1.aptコマンドでインストール可能なOpenJDKを確認します

# sudo apt search "^openjdk.*jdk$"
Sorting... Done
Full Text Search... Done
openjdk-11-jdk/impish-updates,impish-security 11.0.14.1+1-0ubuntu1~21.10 amd64
  OpenJDK Development Kit (JDK)

openjdk-16-jdk/impish 16.0.2+7-2 amd64
  OpenJDK Development Kit (JDK)

openjdk-17-jdk/impish-updates,impish-security 17.0.2+8-1~22.10 amd64
  OpenJDK Development Kit (JDK)

openjdk-18-jdk/impish 18~15ea-4 amd64
  OpenJDK Development Kit (JDK)

openjdk-8-jdk/impish-updates,impish-security 8u312-b07-0ubuntu1~21.10 amd64
  OpenJDK Development Kit (JDK)

2.openjdk-18-jdkをインストールする

# sudo apt-get update
# sudo apt install -y openjdk-18-jdk

3.javaバージョンを確認します

# java --version
openjdk 18-ea 2022-03-15
OpenJDK Runtime Environment (build 18-ea+15-Ubuntu-4)
OpenJDK 64-Bit Server VM (build 18-ea+15-Ubuntu-4, mixed mode, sharing)

 

Ubuntu 21.10

Posted by arkgame