请帮帮我!!我被困了 3 天,无法在我的 ubuntu 18.04 上安装 java;什么都没用 :-(;因为我的信息很少,虽然我尝试过 oracle.com>java14 安装程序套件>下载 tar.gz 文件>无法设置它。以下是详细查询:
apt --fix-broken install 不起作用,sudo apt autoremove 和 dpkg 都说未安装,但在安装时它说 dpkg 已经有更新版本::
adrino@Inspiron:~$ sudo apt-get update
[sudo] password for adrino:
Hit:1 http://in.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:3 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:4 http://in.archive.ubuntu.com/ubuntu bionic-security InRelease
Hit:5 http://packages.microsoft.com/repos/vscode stable InRelease
Hit:6 http://in.archive.ubuntu.com/ubuntu bionic-proposed InRelease
Hit:7 http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic InRelease
Hit:8 https://packagecloud.io/AtomEditor/atom/any any InRelease
Reading package lists... Done
adrino@Inspiron:~$ sudo apt-get upgradable
E: Invalid operation upgradable
adrino@Inspiron:~$ sudo apt list upgradable
Listing... Done
adrino@Inspiron:~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
default-jdk : Depends: openjdk-11-jdk
default-jre : Depends: openjdk-11-jre
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
adrino@Inspiron:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
gstreamer1.0-plugins-base:i386 libasn1-8-heimdal:i386 libasound2:i386
libasound2-plugins:i386 libasyncns0:i386 libatomic1:i386
libavahi-client3:i386 libavahi-common-data:i386 libavahi-common3:i386
libblkid1:i386 libbsd0:i386 libcairo2:i386 libcap2:i386 libcapi20-3:i386
libcdparanoia0:i386 libcom-err2:i386 libcomerr2:i386 libcups2:i386
libdb5.3:i386 libdbus-1-3:i386 libdrm-amdgpu1:i386 libdrm-intel1:i386
libdrm-nouveau2:i386 libdrm-radeon1:i386 libdrm2:i386 libedit2:i386
libelf1:i386 libexif12:i386 libexpat1:i386 libffi6:i386 libflac8:i386
libfontconfig1:i386 libfreetype6:i386 libgcrypt20:i386 libgd3:i386
libgl1:i386 libgl1-mesa-dri:i386 libgl1-mesa-glx:i386 libglapi-mesa:i386
libglib2.0-0:i386 libglu1-mesa:i386 libglvnd0:i386 libglx-mesa0:i386
libglx0:i386 libgmp10:i386 libgnutls30:i386 libgpg-error0:i386
libgphoto2-6:i386 libgphoto2-port12:i386 libgpm2:i386 libgsm1:i386
libgssapi-krb5-2:i386 libgssapi3-heimdal:i386
libgstreamer-plugins-base1.0-0:i386 libgstreamer1.0-0:i386
libhcrypto4-heimdal:i386 libheimbase1-heimdal:i386 libheimntlm0-heimdal:i386
libhogweed4:i386 libhx509-5-heimdal:i386 libicu60:i386 libidn2-0:i386
libieee1284-3:i386 libjack-jackd2-0:i386 libjbig0:i386 libjpeg-turbo8:i386
libjpeg8:i386 libk5crypto3:i386 libkeyutils1:i386 libkrb5-26-heimdal:i386
libkrb5-3:i386 libkrb5support0:i386 liblcms2-2:i386 libldap-2.4-2:i386
libllvm10:i386 libltdl7:i386 liblz4-1:i386 libmount1:i386 libmpg123-0:i386
libncurses5:i386 libnettle6:i386 libodbc1:i386 libogg0:i386 libopenal1:i386
libopus0:i386 liborc-0.4-0:i386 libosmesa6:i386 libp11-kit0:i386
libpcap0.8:i386 libpciaccess0:i386 libpixman-1-0:i386 libpng16-16:i386
libpulse0:i386 libroken18-heimdal:i386 libsamplerate0:i386 libsane1:i386
libsasl2-2:i386 libsasl2-modules:i386 libsasl2-modules-db:i386
libsensors4:i386 libsndfile1:i386 libsndio6.1:i386 libspeexdsp1:i386
libsqlite3-0:i386 libssl1.1:i386 libstdc++6:i386 libsystemd0:i386
libtasn1-6:i386 libtheora0:i386 libtiff5:i386 libtinfo5:i386 libudev1:i386
libunistring2:i386 libusb-1.0-0:i386 libuuid1:i386 libv4l-0:i386
libv4lconvert0:i386 libvisual-0.4-0:i386 libvorbis0a:i386 libvorbisenc2:i386
libwebp6:i386 libwind0-heimdal:i386 libwine:i386 libwrap0:i386 libx11-6:i386
libx11-xcb1:i386 libxau6:i386 libxcb-dri2-0:i386 libxcb-dri3-0:i386
libxcb-glx0:i386 libxcb-present0:i386 libxcb-render0:i386 libxcb-shm0:i386
libxcb-sync1:i386 libxcb1:i386 libxcomposite1:i386 libxcursor1:i386
libxdamage1:i386 libxdmcp6:i386 libxext6:i386 libxfixes3:i386 libxi6:i386
libxinerama1:i386 libxml2:i386 libxpm4:i386 libxrandr2:i386 libxrender1:i386
libxshmfence1:i386 libxslt1.1:i386 libxxf86vm1:i386 libzstd1:i386
ocl-icd-libopencl1:i386 wine32:i386
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
gsfonts-x11 oracle-java14-installer oracle-java14-set-default
Suggested packages:
binfmt-support visualvm ttf-baekmuk | ttf-unfonts | ttf-unfonts-core
ttf-kochi-gothic | ttf-sazanami-gothic ttf-kochi-mincho
| ttf-sazanami-mincho ttf-arphic-uming
The following NEW packages will be installed:
gsfonts-x11 oracle-java14-set-default
The following packages will be upgraded:
oracle-java14-installer
1 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
Need to get 0 B/43.4 kB of archives.
After this operation, 237 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
/tmp/oracle-java14-installer.config.E2htyx: 18: /tmp/oracle-java14-installer.config.E2htyx: dpkg: not found
oracle-java14-installer failed to preconfigure, with exit status 20
Could not exec dpkg!
E: Sub-process /usr/bin/dpkg returned an error code (100)
adrino@Inspiron:~$ sudo apt autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
default-jdk : Depends: openjdk-11-jdk
default-jre : Depends: openjdk-11-jre
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
adrino@Inspiron:~$
答案1
您想要实现什么?我看到 Java 11 软件包和 Java 14 软件包上都存在错误。您想要安装哪个版本?无论如何:我的建议是完全删除所有 Java 软件包,然后尝试安装您想要的版本。
我发现两个问题,一个是 ,oracle-java14-installer
另一个是openjdk-11-jre
。您说您尝试通过从 Oracle 下载 .tar.gz 文件来安装 Java,但您遇到的问题似乎不相关。
第一个问题是。这似乎来自PPA 的oracle-java14-installer
软件包oracle-java14-installer_14.0.2-1~linuxuprising1
http://ppa.launchpad.net/linuxuprising/java/ubuntu。这是您自己添加的 PPA。尝试使用 删除该包sudo apt-get --purge remove oracle-java14-*
。
的输出sudo apt autoremove
显示The following packages have unmet dependencies: default-jdk : Depends: openjdk-11-jdk default-jre : Depends: openjdk-11-jre
。在我看来,这像是openjdk-11-jre
缺少包。安装时会发生什么?sudo apt update
先执行 ,然后执行sudo apt install openjdk-11-jre
。现在 的输出sudo apt autoremove
没有错误了吗?