本文当前是以最新版系统Debian12为例
安装步骤
1.查找源中包含的jdk版本
sudo apt search openjdk
查询结果如下:
hex@debian:~$ sudo apt search openjdk
正在排序... 完成
全文搜索... 完成
default-jdk/stable 2:1.17-74 amd64
Standard Java or Java compatible Development Kit
default-jdk-doc/stable 2:1.17-74 amd64
Standard Java or Java compatible Development Kit (documentation)
default-jdk-headless/stable 2:1.17-74 amd64
Standard Java or Java compatible Development Kit (headless)
default-jre/stable 2:1.17-74 amd64
Standard Java or Java compatible Runtime
default-jre-headless/stable 2:1.17-74 amd64
Standard Java or Java compatible Runtime (headless)
jtreg/stable 5.1-b01-2 all
Regression Test Harness for the OpenJDK platform
jtreg6/stable,stable-security 6.2+1-3~deb12u1 all
Regression Test Harness for the OpenJDK platform
libasmtools-java/stable 7.0-b09-2 all
OpenJDK AsmTools
libhsdis0-fcml/stable 1.2.2-2 amd64
HotSpot disassembler plugin using FCML
libjax-maven-plugin/stable 0.1.8+dfsg-2 all
Using the xjc goal with OpenJDK 11+
libreoffice/stable 4:7.4.7-1 amd64
office productivity suite (metapackage)
openjdk-17-dbg/stable,stable-security 17.0.9+9-1~deb12u1 amd64
Java runtime based on OpenJDK (debugging symbols)
openjdk-17-demo/stable,stable-security 17.0.9+9-1~deb12u1 amd64
Java runtime based on OpenJDK (demos and examples)
openjdk-17-doc/stable,stable-security 17.0.9+9-1~deb12u1 all
OpenJDK Development Kit (JDK) documentation
openjdk-17-jdk/stable,stable-security,now 17.0.9+9-1~deb12u1 amd64 [已安装]
OpenJDK Development Kit (JDK)
openjdk-17-jdk-headless/stable,stable-security,now 17.0.9+9-1~deb12u1 amd64 [已安装,自动]
OpenJDK Development Kit (JDK) (headless)
openjdk-17-jre/stable,stable-security,now 17.0.9+9-1~deb12u1 amd64 [已安装,自动]
OpenJDK Java runtime, using Hotspot JIT
openjdk-17-jre-headless/stable,stable-security,now 17.0.9+9-1~deb12u1 amd64 [已安装,自动]
OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-17-jre-zero/stable,stable-security 17.0.9+9-1~deb12u1 amd64
Alternative JVM for OpenJDK, using Zero
openjdk-17-source/stable,stable-security 17.0.9+9-1~deb12u1 all
OpenJDK Development Kit (JDK) source files
uwsgi-app-integration-plugins/stable 2.0.21-5.1 amd64
plugins for integration of uWSGI and application
uwsgi-plugin-jvm-openjdk-17/stable 2.0.21-5.1 amd64
Java plugin for uWSGI (OpenJDK 17)
uwsgi-plugin-jwsgi-openjdk-17/stable 2.0.21-5.1 amd64
JWSGI plugin for uWSGI (OpenJDK 17)
uwsgi-plugin-ring-openjdk-17/stable 2.0.21-5.1 amd64
Closure/Ring plugin for uWSGI (OpenJDK 17)
uwsgi-plugin-servlet-openjdk-17/stable 2.0.21-5.1 amd64
JWSGI plugin for uWSGI (OpenJDK 17)
2.安装openjdk
sudo apt install openjdk-17-jdk -y
3.验证安装
java -version
验证结果:
hex@debian:~$ java -version
openjdk version "17.0.9" 2023-10-17
OpenJDK Runtime Environment (build 17.0.9+9-Debian-1deb12u1)
OpenJDK 64-Bit Server VM (build 17.0.9+9-Debian-1deb12u1, mixed mode, sharing)
如出现如上结果,说明安装成功!!!!!