我正在使用 antiX 22 x64 版本,并且能够安装默认 Java(Java-11)和 Java 17
$ sudo apt install default-jre
和
$ sudo apt install openjdk-17-jre
但是当我尝试安装 Java 8 时出现此错误:
$ sudo apt install openjdk-8-jre
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package openjdk-8-jre is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
nvidia-openjdk-8-jre
E: Package 'openjdk-8-jre' has no installation candidate
然后我安装以下包:
$ sudo apt install nvidia-openjdk-8-jre
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
nvidia-openjdk-8-jre
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 28.1 MB of archives.
After this operation, 103 MB of additional disk space will be used.
Get:1 http://ftp.us.debian.org/debian bullseye/non-free amd64 nvidia-openjdk-8-jre amd64 9.+8u332-ga-1~~deb9u1~11.2.2-3+deb11u3 [28.1 MB]
Fetched 28.1 MB in 16s (1,783 kB/s)
Selecting previously unselected package nvidia-openjdk-8-jre.
(Reading database ... 189063 files and directories currently installed.)
Preparing to unpack .../nvidia-openjdk-8-jre_9.+8u332-ga-1~~deb9u1~11.2.2-3+deb11u3_amd64.deb ...
Unpacking nvidia-openjdk-8-jre (9.+8u332-ga-1~~deb9u1~11.2.2-3+deb11u3) ...
Setting up nvidia-openjdk-8-jre (9.+8u332-ga-1~~deb9u1~11.2.2-3+deb11u3) ...
Processing triggers for libc-bin (2.31-13+deb11u6) ...
但是当我列出 Java 版本时,没有 Java 8:
$ update-alternatives --list java
/usr/lib/jvm/java-11-openjdk-amd64/bin/java
/usr/lib/jvm/java-17-openjdk-amd64/bin/java
我如何安装 Java 8?谢谢。
答案1
- 从以下位置下载 x64 RPM 包Java 网站
- 跑步
sudo apt install alien
- 跑步
cd {path_to_rpm_file_dir}
- 跑步
alien {rpm_file_name}
- 运行
sudo apt install ./{name_of_generated_deb_file}
然后尝试update-alternatives --list java
再次运行