Java安装在Ubuntu 14上失败

时间:2017-10-17 22:16:44

标签: java ubuntu ubuntu-14.04

我正在尝试在我的ubuntu 14.0.4中安装jave 8(jre / jdk)

sudo apt-get update

sudo apt-get install oracle-java8-installer

我得到以下错误

Using wget settings from /var/cache/oracle-jdk8-installer/wgetrc
Downloading Oracle Java 8...
--2017-10-17 16:42:09--  http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 64.78.224.186, 64.78.224.185
Connecting to download.oracle.com (download.oracle.com)|64.78.224.186|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz [following]
--2017-10-17 16:42:10--  https://edelivery.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.217.152.181, 2600:141b:13:28c::2d3e
Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.217.152.181|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz?AuthParam=1508276650_49e5615c0aa8584dd72b809fbec787eb [following]
--2017-10-17 16:42:10--  http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz?AuthParam=1508276650_49e5615c0aa8584dd72b809fbec787eb
Connecting to download.oracle.com (download.oracle.com)|64.78.224.186|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-10-17 16:42:11 ERROR 404: Not Found.

download failed
Oracle JDK 8 is NOT installed.

看起来它正在寻找8u144,这是不可用的。

我如何让它寻找8u151?

我这样做了 sudo add-apt-repository ppa:webupd8team/java - >没有运气

4 个答案:

答案 0 :(得分:7)

截至今天这已成为一个问题(我们每天都会在oracle-8-installer点击一次webupd8team ppa)。根据过去的经验,这可能是由于Oracle在一夜之间发布了他们的季度Java更新(8u1518u152),并移动或删除了8u144。如果你深入研究ppa,你会看到它只引用8u144。

我不知道如何管理webupd8team ppa,但可能需要对维护者进行一些人工干预才能解决问题。

答案 1 :(得分:6)

我正在尝试这个解决方案: https://ubuntuforums.org/showthread.php?t=2374686 - >目前没有运气

什么对我有用,我用手动尝试了这个:

  1. 创建一个放置JDK的文件夹

    mkdir /opt/jdk cd /opt

  2. 下载最新的JDK:

    wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u152-b16/aa0333dd3019491ca4f6ddbe78cdb6d0/jdk-8u152-linux-x64.tar.gz

  3. 提取

    tar -zxf jdk-8u152-linux-x64.tar.gz -C /opt/jdk

  4. 将其设为默认

    update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_152/bin/java 100

    update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_152/bin/javac 100

答案 2 :(得分:4)

"作为临时工作":

cd /var/lib/dpkg/info
sudo sed -i 's|JAVA_VERSION=8u144|JAVA_VERSION=8u152|' oracle-java8-installer.*
sudo sed -i 's|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u152-b16/aa0333dd3019491ca4f6ddbe78cdb6d0/|' oracle-java8-installer.*
sudo sed -i 's|SHA256SUM_TGZ="e8a341ce566f32c3d06f6d0f0eeea9a0f434f538d22af949ae58bc86f2eeaae4"|SHA256SUM_TGZ="218b3b340c3f6d05d940b817d0270dfe0cfd657a636bad074dcabe0c111961bf"|' oracle-java8-installer.*
sudo sed -i 's|J_DIR=jdk1.8.0_144|J_DIR=jdk1.8.0_152|' oracle-java8-installer.*

然后再次尝试安装JAVA。从ubuntuforums thread开始。

答案 3 :(得分:0)

将Java Oracle tar球下载到主目录后,您需要运行以下脚本来自动安装Java 8.

#!/bin/bash -e

JAVA_VER=$(javadd -version 2>&1 | sed -n ';s/.* version "\(.*\)\.\(.*\)\..*"/\1\2/p;')

if [ "${JAVA_VER}" != "18" ]; then
    file_name="jdk-8u172-linux-x64.tar.gz"
    cd ~
    sudo mkdir -p /opt/jdk
    sudo tar -zxf ~/${file_name} -C /opt/jdk

    sudo apt-get remove -y --purge openjdk-\* || true
    cd /opt/jdk/jdk1.8.0_172/bin

    for j in `ls j*`; do
        sudo update-alternatives --force --install /usr/bin/${j} ${j} /opt/jdk/jdk1.8.0_172/bin/${j} 100
    done
    sudo update-alternatives --display java
fi