我安装了 Ubuntu 13.04 64 位,我想为 Oracle Sql Developer 安装 JDK 7。我的问题是,当我尝试安装它时,我得到了以下信息:
kwarr@kwarr-K54LY:~$ sudo apt-get install oracle-java7-installer
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
visualvm 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/17,6 kB of archives.
After this operation, 110 kB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously unselected package oracle-java7-installer.
(Reading database ... 200447 files and directories currently installed.)
Unpacking oracle-java7-installer (from .../oracle-java7-installer_7u51-0~webupd8~1_all.deb) ...
oracle-license-v1-1 license has already been accepted
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
Processing triggers for shared-mime-info ...
Setting up oracle-java7-installer (7u51-0~webupd8~1) ...
Downloading Oracle Java 7...
--2014-03-22 15:18:09-- http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 77.109.171.147, 77.109.171.160
Connecting to download.oracle.com (download.oracle.com)|77.109.171.147|: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-22 15:18:10-- https://edelivery.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.54.22.140
Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.54.22.140|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/errors/download-fail-1505220.html [following]
--2014-03-22 15:18:10-- http://download.oracle.com/errors/download-fail-1505220.html
Connecting to download.oracle.com (download.oracle.com)|77.109.171.147|:80... connected.
HTTP request sent, awaiting response... 200 OK
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)
我已经在互联网上搜索并找到了一些对人们有用的解决方案:
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
和
sudo dpkg -P oracle-java7-installer
sudo apt-get -f install
sudo apt-get install oracle-java7-installer
但它们对我都不起作用。仍然收到相同的消息。有人能帮我解决这个问题吗?
答案1
请按照以下步骤安装 oracle java:
下载最新的 Java SE SDK 版本。
http://www.oracle.com/technetwork/java/javase/downloads/index.html
解压档案:
tar -xzvf /root/jdk-7u17-linux-x64.tar.gz mv jdk1.7.0_17 /opt cd /opt/jdk1.7.0_17
此步骤将下载的 Java 版本注册为替代版本,并将其切换为默认版本:
update-alternatives --install /usr/bin/java java /opt/jdk1.7.0_17/bin/java 1 update-alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_17/bin/javac 1 update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jdk1.7.0_17/jre/lib/amd64/libnpjp2.so 1 update-alternatives --set java /opt/jdk1.7.0_17/bin/java update-alternatives --set javac /opt/jdk1.7.0_17/bin/javac update-alternatives --set mozilla-javaplugin.so /opt/jdk1.7.0_17/jre/lib/amd64/libnpjp2.so
测试
检查当前正在运行的 Java 版本
java -version
要检查浏览器插件,请浏览至http://www.java.com/然后点击“我有 Java 吗?”