在 Windows-subsystem-for-linux 上运行的 ubuntu 上安装 java

问题描述 投票:0回答:1

尝试在 Windows-subsystem-for-linux 上运行 java 我得到:

root@ST-NBXPS33:~# java
Command 'java' not found, but can be installed with: 
apt install default-jre              # version 2:1.17-75, or 
apt install openjdk-17-jre-headless  # version 17.0.12+7-1ubuntu2~24.04 
apt install openjdk-21-jre-headless  # version 21.0.4+7-1ubuntu2~24.04

然后 root@ST-NBXPS33:~# apt install default-jre 正在阅读包裹清单...完成 构建依赖树...完成 读取状态信息...完成

default-jre is already the newest version (2:1.21-75+exp1).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 default-jre : Depends: openjdk-21-jre but it is not going to be installed
 default-jre-headless : Depends: openjdk-21-jre-headless but it is not going to be installed
 openlogic-openjdk-17-hotspot : Depends: fonts-dejavu but it is not installable
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
root@ST-NBXPS33:~#

然后

root@ST-NBXPS33:~# apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  libatk-wrapper-java libatk-wrapper-java-jni openjdk-21-jre openjdk-21-jre-headless x11-utils
Suggested packages:
  libnss-mdns fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei | fonts-wqy-zenhei fonts-indic mesa-utils
Recommended packages:
  luit
The following packages will be REMOVED:
  openlogic-openjdk-17-hotspot
The following NEW packages will be installed:
  libatk-wrapper-java libatk-wrapper-java-jni openjdk-21-jre openjdk-21-jre-headless x11-utils
0 upgraded, 5 newly installed, 1 to remove and 0 not upgraded.
3 not fully installed or removed.
Need to get 46.8 MB/47.1 MB of archives.
After this operation, 189 MB disk space will be freed.
Do you want to continue? [Y/n] y
Ign:1 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 openjdk-21-jre-headless amd64 21.0.4+7-1ubuntu2~24.04
Ign:2 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 openjdk-21-jre amd64 21.0.4+7-1ubuntu2~24.04
Err:1 http://security.ubuntu.com/ubuntu noble-updates/main amd64 openjdk-21-jre-headless amd64 21.0.4+7-1ubuntu2~24.04
  404  Not Found [IP: 185.125.190.82 80]
Err:2 http://security.ubuntu.com/ubuntu noble-updates/main amd64 openjdk-21-jre amd64 21.0.4+7-1ubuntu2~24.04
  404  Not Found [IP: 185.125.190.82 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/o/openjdk-21/openjdk-21-jre-headless_21.0.4%2b7-1ubuntu2%7e24.04_amd64.deb  404  Not Found [IP: 185.125.190.82 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/o/openjdk-21/openjdk-21-jre_21.0.4%2b7-1ubuntu2%7e24.04_amd64.deb  404  Not Found [IP: 185.125.190.82 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
root@ST-NBXPS33:~#

所以我还是没有java。有什么想法吗?

java windows-subsystem-for-linux
1个回答
0
投票

您的包裹清单似乎已过时。尝试跑步

apt-get update

如果不能解决问题,那么恢复默认存储库可能会有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.