安装Oracle Java 6 错误问题

安装Oracle Java 6 错误问题

我正在尝试在 Ubuntu 16.04 上安装 oracle-java6-installer。

我按照以下步骤安装它:

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

但我收到了这个错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
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:
oracle-java6-installer
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/21.0 kB of archives.
After this operation, 209 kB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously unselected package oracle-java6-installer.
(Reading database ... 215570 files and directories currently 
installed.)
Preparing to unpack .../oracle-java6-installer_6u45- 
0~webupd8~8_all.deb ...
oracle-license-v1-1 license has already been accepted
Unpacking oracle-java6-installer (6u45-0~webupd8~8) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209- 
0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for shared-mime-info (1.5-2ubuntu0.1) ...
Setting up oracle-java6-installer (6u45-0~webupd8~8) ...
Downloading Oracle Java 6...
--2018-04-19 09:46:17--  http://download.oracle.com/otn- 
pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin
Resolving download.oracle.com (download.oracle.com)... 23.53.64.147
Connecting to download.oracle.com 
(download.oracle.com)|23.53.64.147|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/6u45-b06/jdk- 
6u45-linux-x64.bin [following]
--2018-04-19 09:46:17--  https://edelivery.oracle.com/otn- 
pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin
Resolving edelivery.oracle.com (edelivery.oracle.com)... 
104.116.18.92, 2600:1417:1b:184::2d3e, 2600:1417:1b:188::2d3e
Connecting to edelivery.oracle.com 
(edelivery.oracle.com)|104.116.18.92|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk- 
6u45-linux-x64.bin? 
AuthParam=1524102497_fa8d9de89ff9d81e73b656b883c0b633 [following]
--2018-04-19 09:46:17--  http://download.oracle.com/otn- 
pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin? 
AuthParam=1524102497_fa8d9de89ff9d81e73b656b883c0b633
Connecting to download.oracle.com 
(download.oracle.com)|23.53.64.147|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-04-19 09:46:18 ERROR 404: Not Found.

download failed
Oracle JDK 6 is NOT installed.
dpkg: error processing package oracle-java6-installer (--configure):
subprocess installed post-installation script returned error exit 
status 1
Errors were encountered while processing:
oracle-java6-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)

我怎么解决这个问题?

答案1

openjdk-6-jdk 在 Ubuntu 16.04 及更高版本中没有安装候选项。建议使用以下命令从终端安装 openjdk-8-jdk:

sudo apt install openjdk-8-jdk

Java 6 仍然可用Java SE 6 存档下载Oracle 官方网站的网页。选择当前名为 jdk-6u45-linux-x64.bin(适用于 64 位架构)或 jdk-6u45-linux-i586.bin(适用于 32 位架构)的 .tar.gz 文件。Oracle 给出此警告,Oracle Java Archive 软件包中的软件包不再使用最新的安全补丁进行更新。

这些旧版本的 JRE 和 JDK 旨在帮助开发人员调试旧系统中的问题。它们未使用最新的安全补丁进行更新,不建议在生产中使用。


Java 6 安装

  1. 下载 jdk-6u45-linux-x64.bin 文件。如果你安装的是 32 位 Ubuntu,请下载 jdk-6u45-linux-i586.bin。

  2. 使下载的 bin 文件可执行。

    chmod +x jdk-6u45-linux-x64.bin  
    
  3. 提取 bin 文件。

    ./jdk-6u45-linux-x64.bin  
    
  4. /usr/lib如果不存在名为“jvm”的文件夹,请使用以下命令在其中创建一个名为“jvm”的文件夹。

    sudo mkdir /usr/lib/jvm  
    
  5. 将解压的文件夹移动到新创建的 jvm 文件夹中。

    sudo mv jdk1.6.0_45 /usr/lib/jvm/  
    
  6. 要安装 Java 源,请运行以下命令。

    sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 1  
    sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/bin/java 1  
    sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_45/bin/javaws 1  
    
  7. 要使其成为默认的 java:

    sudo update-alternatives --config javac    
    sudo update-alternatives --config java    
    sudo update-alternatives --config javaws    
    
  8. 要使符号链接指向新的 Java 位置,请运行以下命令。

     ls -la /etc/alternatives/java*  
    
  9. 要验证 Java 是否已正确安装,请运行此命令。

    java -version  
    

修订自:在 Ubuntu 上安装 Oracle Java 6

答案2

Oracle 不再支持 Java 6(一些更新仍可通过 Java SE 支持计划获得,但并不公开 - 来自维基百科)。请安装 Java 8 或更新版本。

相关内容