尽管已安装 JDK,但仍然出现“未安装 Oracle JDK 7”错误

尽管已安装 JDK,但仍然出现“未安装 Oracle JDK 7”错误

我通过下载 jdk-7u40-linux-x64.tar.gz 并按照以下方法手动安装了 Java Jdk此链接。当我检查它的版本时,一切正常:

user@mylaptop:~$ java -version
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

但是当我尝试使用此命令安装 pip 时:

sudo apt-get install python-pip

或者输入如下内容:

sudo apt-get -f install

我收到此错误:

user@mylaptop:~$ sudo apt-get install python-pip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-pip is already the newest version.
The following packages were automatically installed and are no longer required:
  fonts-dejavu-extra libbonobo2-0 libbonobo2-common libgconf2-4 libgnome2-0
  libgnome2-bin libgnome2-common libgnomevfs2-0 libgnomevfs2-common libice-dev
  libidl-common libidl0 liborbit-2-0 liborbit2 libpthread-stubs0-dev libsm-dev
  libx11-dev libx11-doc libxau-dev libxcb1-dev libxdmcp-dev libxt-dev
  tzdata-java x11proto-core-dev x11proto-input-dev x11proto-kb-dev
  xorg-sgml-doctools xtrans-dev
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 476 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up oracle-java7-installer (7u76+7u60arm-0~webupd8~0) ...
Downloading Oracle Java 7...
--2015-02-01 05:55:03--  http://download.oracle.com/otn-pub/java/jdk/7u76-b13/jdk-7u76-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 93.158.110.104, 93.158.110.115
Connecting to download.oracle.com (download.oracle.com)|93.158.110.104|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2015-02-01 05:55:12 ERROR 403: Forbidden.

download failed
Oracle JDK 7 is NOT installed.
dpkg: error processing package 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)

你能告诉我如何解决这个问题吗?

答案1

您的系统中安装了 webupd8 oracle-java7-installer ,它正在尝试通过从 Oracle 网站下载来安装 Oracle Java。Oracle 网站限制了您的访问,这就是您收到此错误的原因。

如果您已经手动安装了 Java,则可以删除 oracle-java7-installer

运行以下命令来修复它。

sudo apt-get purge oracle-java7-installer
sudo apt-get autoremove
sudo apt-get install -f

它应该可以解决 dpkg 错误。

相关内容