gpt4 book ai didi

java - Oracle java 7 安装在 Ubuntu E : Sub-process/usr/bin/dpkg returned an error code (1)

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:42:37 24 4
gpt4 key购买 nike

我无法按照此链接中提供的步骤安装 oracle java 7: http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

我得到以下信息:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
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:
oracle-java7-installer
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/18,6 kB of archives.
After this operation, 193 kB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously unselected package oracle-java7-installer.
(Reading database ... 273801 files and directories currently installed.)
Unpacking oracle-java7-installer (from .../oracle-java7-installer_7u51-0~webupd8~4_all.deb) ...
oracle-license-v1-1 license has already been accepted
Processing triggers for desktop-file-utils ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for gnome-menus ...
Processing triggers for shared-mime-info ...
Setting up oracle-java7-installer (7u51-0~webupd8~4) ...
Downloading Oracle Java 7...
--2014-03-20 12:12:52-- http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 131.178.7.201
Connecting to download.oracle.com (download.oracle.com)|131.178.7.201|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz [following]
--2014-03-20 12:12:52-- https://edelivery.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.204.22.140
Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.204.22.140|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz?AuthParam=1395339292_7fc586697ce74b02fa16cb3ec88d3a9d [following]
--2014-03-20 12:12:52-- http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz?AuthParam=1395339292_7fc586697ce74b02fa16cb3ec88d3a9d
Connecting to download.oracle.com (download.oracle.com)|131.178.7.201|:80... connected.
HTTP request sent, awaiting response... 416 Requested Range Not Satisfiable

The file is already fully retrieved; nothing to do.

Download done.
Removing outdated cached downloads...
sha256sum mismatch jdk-7u51-linux-x64.tar.gz
Oracle JDK 7 is NOT installed.
dpkg: error processing oracle-java7-installer (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
oracle-java7-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)

我也尝试按照 https://help.ubuntu.com/community/Java 中的说明进行操作:

sudo rm /var/lib/dpkg/info/oracle-java7-installer*
sudo apt-get purge oracle-java7-installer*
sudo rm /etc/apt/sources.list.d/*java*
sudo apt-get update

然后:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

仍然没有运气:(谁能帮帮我?我很困惑为什么它不起作用。提前致谢。

编辑:在以下链接中找到解决方案:https://askubuntu.com/questions/414885/oracle-jdk-7-is-not-installed-error

解决方案:

sudo dpkg -P oracle-java7-installer
sudo apt-get -f install
sudo apt-get install oracle-java7-installer

最佳答案

请按照以下步骤安装 oracle java:

下载最新 Java SE SDK 版本。

http://www.oracle.com/technetwork/java/javase/downloads/index.html

解压存档:

tar -xzvf jdk-8-linux-x64.tar.gz
mv jdk1.8.0 /opt
cd /opt/jdk1.8.0

此步骤将下载的 Java 版本注册为替代版本,并将其切换为默认版本:

update-alternatives --install /usr/bin/java java /opt/jdk1.8.0/bin/java 1
update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0/bin/javac 1
update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jdk1.8.0/jre/lib/amd64/libnpjp2.so 1
update-alternatives --set java /opt/jdk1.8.0/bin/java
update-alternatives --set javac /opt/jdk1.8.0/bin/javac
update-alternatives --set mozilla-javaplugin.so /opt/jdk1.8.0/jre/lib/amd64/libnpjp2.so

测试

查看当前运行的Java版本

java -version

输出

java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

要检查浏览器插件,请浏览到 http://www.java.com/然后点击“我有 Java 吗?”

引用:https://askubuntu.com/questions/437776/ubuntu-13-04-unable-to-install-jdk7

关于java - Oracle java 7 安装在 Ubuntu E : Sub-process/usr/bin/dpkg returned an error code (1),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22541853/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com