Oracle java 7 在 Ubuntu E 中的安装:子进程 /usr/bin/dpkg 返回错误代码 (1)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22541853/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Oracle java 7 Installation in Ubuntu E: Sub-process /usr/bin/dpkg returned an error code (1)
提问by user3443339
I can't install oracle java 7 following the steps provided in this link: http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html
我无法按照此链接中提供的步骤安装 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
I get the following:
我得到以下信息:
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)
I have also tried doing what says in https://help.ubuntu.com/community/Java:
我也试过做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
Then:
然后:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
And still no luck :( Could anyone help me? I am quite lost at why It isn't working. Thanks in advance.
仍然没有运气:(有人可以帮助我吗?我很困惑为什么它不起作用。提前致谢。
EDIT: Found a solution in the following link: https://askubuntu.com/questions/414885/oracle-jdk-7-is-not-installed-error
编辑:在以下链接中找到解决方案:https: //askubuntu.com/questions/414885/oracle-jdk-7-is-not-installed-error
SOLUTION:
解决方案:
sudo dpkg -P oracle-java7-installer
sudo apt-get -f install
sudo apt-get install oracle-java7-installer
回答by ken
Tried with the solution but still not working. Even when I tried to download the jdk tar from the Oracle site it still failed at around 30-50MB. Anyway I found an article which talks about it and finally got it fixed!
尝试了解决方案,但仍然无法正常工作。即使当我尝试从 Oracle 站点下载 jdk tar 时,它仍然以大约 30-50MB 的速度失败。无论如何,我找到了一篇讨论它的文章,并最终修复了它!
Oracle Adds License to oracle-java7-installer and Now It Fails(published on March 2014)
Oracle 向 oracle-java7-installer 添加许可证但现在失败(2014 年 3 月发布)
Basically the steps are similar except the last one:
除了最后一个步骤外,基本上步骤是相似的:
sudo apt-get update
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
回答by gihanchanuka
Please follow below steps to install oracle java:
请按照以下步骤安装 oracle java:
Downloadthe latestJava SE SDK version.
下载了最新的Java SE SDK版本。
http://www.oracle.com/technetwork/java/javase/downloads/index.html
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Untar the Archive:
解压存档:
tar -xzvf jdk-8-linux-x64.tar.gz
mv jdk1.8.0 /opt
cd /opt/jdk1.8.0
This step registers the downloaded version of Java as an alternative, and switches it to be used as the default:
此步骤将下载的 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
Test
测试
To check the version of Java you are now running
检查您正在运行的 Java 版本
java -version
Output
输出
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)
To check the browser plugin browse to http://www.java.com/and click “Do I have Java?”
要检查浏览器插件,请浏览到http://www.java.com/并单击“我有 Java 吗?”
Ref: https://askubuntu.com/questions/437776/ubuntu-13-04-unable-to-install-jdk7
参考:https: //askubuntu.com/questions/437776/ubuntu-13-04-unable-to-install-jdk7
回答by Anzar Ansari
sudo dpkg -P oracle-java7-installer
sudo dpkg -P oracle-java7-installer
sudo apt-get -f install
sudo apt-get -f install
回答by A1Gard
回答by Hadi Rahjoo
i think that your download is corrupted you have to remove the corrupted package first by code :
我认为您的下载已损坏,您必须先通过代码删除损坏的包:
sudo apt-get purge oracle-java7-installer
clean your apt :
清理你的 apt :
sudo apt clean
remove and reimport the ropsitory:
删除并重新导入 ropsitory:
sudo add-apt-repository --remove ppa:webupd8team/java
sudo apt-get update
sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
install your package again :
再次安装您的软件包:
sudo apt-get install oracle-java7-installer
enjoy it bro ! if the problem hasn't solved try using VPN . Maybe there is a filtering between you and the oracle website
享受吧兄弟!如果问题没有解决,请尝试使用 VPN 。也许你和oracle网站之间有过滤
回答by Devin
The reason is : WHY ORACLE JAVA 7 AND 6 INSTALLERS NO LONGER WORK
原因是: 为什么 ORACLE JAVA 7 和 6 安装程序不再工作
If you have an Oracle Support account and you really need Oracle JDK 6 or 7, you can get the installers from the WebUpd8 PPA to work by downloading the binaries and placing them in the following folder:
如果您有 Oracle Support 帐户并且确实需要 Oracle JDK 6 或 7,则可以通过下载二进制文件并将它们放在以下文件夹中,从 WebUpd8 PPA 获取安装程序:
- /var/cache/oracle-jdk6-installer/ for JDK 6 (you'll need version 6u45)
- /var/cache/oracle-jdk7-installer/ for JDK 7 (you'll need version 7u80 for 32bit and 64bit or 7u60 for arm)
- /var/cache/oracle-jdk6-installer/ 用于 JDK 6(您需要 6u45 版本)
- /var/cache/oracle-jdk7-installer/ 用于 JDK 7(您需要 7u80 版用于 32 位和 64 位或 7u60 版用于 arm)
... and then install the oracle-java6-installer or oracle-java7-installer package.
...然后安装 oracle-java6-installer 或 oracle-java7-installer 包。