1.下載并上傳到服務(wù)器:https://www.oracle.com/java/technologies/downloads/#java21
2.執(zhí)行命令安裝
dpkg -i jdk-22_linux-x64_bin.deb
從以上截圖看出丰榴,無需設(shè)置環(huán)境變量货邓,已經(jīng)自動好了
官方文檔:
Installing the 64-Bit JDK Package on Debian-based Linux Platforms
You can install the JDK Debian package for 64-bit Linux from the (.deb) file.
To install the 64-bit JDK Debian package on a Linux platform:
Download the required file:
jdk-22.interim.update.patch_linux-x64_bin.deb. For example jdk-22_linux-x64_bin.deb
Before you download a file, you must accept the license agreement. Anyone (not only root users) can install the archive file in any location having write access.
Install the package using the following command:
$ sudo dpkg -i jdk-22_linux-x64_bin.deb
The Java Development Kit files are installed into /usr/lib/jvm/jdk-<FEATURE>-oracle-<ARCH> directory. For example, JDK 22 releases for x64 will be installed in /usr/lib/jvm/jdk-22-oracle-x64 directory.
Delete the .deb file if you want to save disk space.