apt-get 安装 oracle java 7 停止工作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44142450/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 03:25:47  来源:igfitidea点击:

apt-get installing oracle java 7 stopped working

javaoraclejava-7apt-get

提问by ahong

Recently apt-get install -y oracle-java7-installerstopped working.

最近apt-get install -y oracle-java7-installer停止工作。

I know in their roadmap, I think the public version is no longer supported, but it's been working all the way until recently. http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

我知道在他们的路线图中,我认为不再支持公共版本,但直到最近它一直在工作。 http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

Anyone have a work around for this?

任何人都可以解决这个问题?

http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz?AuthParam=1495560077_4041e14adcb5fd7e68827ab0e15dc3b1
Connecting to download.oracle.com (download.oracle.com)|96.6.45.99|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-05-23 10:19:17 ERROR 404: Not Found.

回答by Meir Maor

It appears Oracle has moved the download link, you can still fetch the tar ball from the oracle website after jumping through some hoops. The WebUpd8 installer is currently broken. The official explanation can be found at http://www.webupd8.org/2017/06/why-oracle-java-7-and-6-installers-no.html

看来甲骨文已经移动了下载链接,你仍然可以在跳过一些箍后从甲骨文网站获取tar球。WebUpd8 安装程序当前已损坏。官方解释可以在http://www.webupd8.org/2017/06/why-oracle-java-7-and-6-installers-no.html找到



Download Method 1: Login into to Oracle site

下载方法一:登录Oracle站点

The link now seems to be: http://download.oracle.com/otn/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gznotice "otn" and not "otn-pub", but at least from the website you seem to need to be signed in and not only accept the license agreement.

现在的链接似乎是:http: //download.oracle.com/otn/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz注意“otn”而不是“otn-pub”,但至少从网站上看,您似乎需要登录,而不仅仅是接受许可协议。

It may be possible with debconf to change the url from otn-pub to otn and get the installer to work but I haven't tried. You can fetch the binary yourself and either install manually or with the installer pointing it to wherever you put the downloaded tar ball.

使用 debconf 可能可以将 url 从 otn-pub 更改为 otn 并使安装程序正常工作,但我还没有尝试过。您可以自己获取二进制文件,然后手动安装或安装程序将其指向您放置下载的 tar 球的任何位置。

Edit: It seems there isn't a way to configure download URL (though you can hiHyman it with hosts as in another answer).

编辑:似乎没有办法配置下载 URL(尽管您可以像在另一个答案中一样使用主机劫持它)。

Download Method 2: Use a trusted mirror

下载方法二:使用可信镜像

If you want to download jdk-7u80-linux-x64.tar.gz from a script without logging into to oracle it hosted locations include:

如果您想从脚本下载 jdk-7u80-linux-x64.tar.gz 而不登录到 oracle,它托管的位置包括:

EDIT: The sha256 has been removed from this answer because (as this edit demonstrates) anyone can edit said hash. Get your hashes from a trusted source. Suggestions include:

编辑:sha256 已从该答案中删除,因为(如本编辑所示)任何人都可以编辑所述哈希。从可信来源获取您的哈希值。建议包括:



Install Method 1: Prepopulate cache

安装方法 1:预填充缓存

#put the file in the default cache location:
sudo mv jdk-7u80-linux-x64.tar.gz /var/cache/oracle-jdk7-installer/

#then install normally: 
sudo apt-get install oracle-java7-installer

Install Method 2: (more elegant IMHO) put tar ball anywhere and tell the installer where to look

安装方法 2:(更优雅的恕我直言)把焦油球放在任何地方,并告诉安装程序在哪里看

#setup ppa (you probably came here after already doing this)
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update

#put the file in a temporary location:
sudo mv jdk-7u80-linux-x64.tar.gz /tmp/


#set local path to /tmp (or any other path)
echo oracle-java7-installer oracle-java7-installer/local select /tmp | \
sudo /usr/bin/debconf-set-selections


#While your at it you may want tp approve license (or skip this and approve when prompted) 
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | \
sudo /usr/bin/debconf-set-selections

#then install normally: 
sudo apt-get install oracle-java7-installer

回答by soormacode

So looks like the direct links to the download no longer work( As noted by Meir Maor above)

所以看起来下载的直接链接不再有效(正如上面的 Meir Maor 所指出的)

Here are the steps to get this running again:

以下是让其再次运行的步骤:

  1. Go to http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.htmland accept the license. Download the file we need (jdk-7u80-linux-x64.tar.gz in this case)

  2. Assuming the file downloaded to your Downloads directory, we need to move it to /var/cache/oracle-jdk7-installer

    cd ~/Downloads (Change to directory to which you saved file from step 1)
    sudo mkdir /var/cache/oracle-jdk7-installer
    sudo mv jdk-7u80-linux-x64.tar.gz /var/cache/oracle-jdk7-installer/
    
  3. Not sure if necessary but I had luck with this:

    echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
    
  4. Run the installer now. It will use the file we saved in /var/cache instead of trying to download it from Oracle

    sudo apt-get install oracle-java7-installer
    
  1. 转至http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html并接受许可。下载我们需要的文件(这里是jdk-7u80-linux-x64.tar.gz)

  2. 假设文件下载到您的 Downloads 目录,我们需要将其移动到 /var/cache/oracle-jdk7-installer

    cd ~/Downloads (Change to directory to which you saved file from step 1)
    sudo mkdir /var/cache/oracle-jdk7-installer
    sudo mv jdk-7u80-linux-x64.tar.gz /var/cache/oracle-jdk7-installer/
    
  3. 不确定是否有必要,但我很幸运:

    echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
    
  4. 现在运行安装程序。它将使用我们保存在 /var/cache 中的文件,而不是尝试从 Oracle 下载它

    sudo apt-get install oracle-java7-installer
    

I got step 3 from http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html

我从http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html得到了第 3 步

回答by Tony

I just ran into this trying to install Java 6 (don't ask).

我刚刚在尝试安装 Java 6 时遇到了这个问题(不要问)。

Since I'm short on time, I was fine with a quick and dirty answer. I noticed the URL looked for by the installer was http-based (vs https), which makes the below solution possible.

由于时间不够,我可以快速而肮脏地回答。我注意到安装程序查找的 URL 是基于 http 的(vs https),这使得以下解决方案成为可能。

  1. Make sure a web server is installed (I already had Apache on my box)

  2. Download the file that is requested. In your case that is jdk-7u80-linux-x64.tar.gz. See Meir Maor's answer above

  3. On your local web server, recreate the path structure requested for the file. In your case that is otn-pub/java/jdk/7u80-b15.

  4. Copy the downloaded file into the path above

  5. Edit /etc/hosts and add 127.0.0.1 download.oracle.com

  6. Run apt-get install -y oracle-java7-installeragain.

  7. The installer will now grab the file from your local web server and complete successfully.

  1. 确保安装了 Web 服务器(我的机器上已经安装了 Apache)

  2. 下载请求的文件。在你的情况下是 jdk-7u80-linux-x64.tar.gz见上面Meir Maor的回答

  3. 在您的本地 Web 服务器上,重新创建为文件请求的路径结构。在你的情况下是otn-pub/java/jdk/7u80-b15

  4. 将下载的文件复制到上面的路径中

  5. 编辑 /etc/hosts 并添加 127.0.0.1 download.oracle.com

  6. 再跑apt-get install -y oracle-java7-installer

  7. 安装程序现在将从您的本地 Web 服务器获取文件并成功完成。

There may be a better way to do this, but it worked for me.

可能有更好的方法来做到这一点,但它对我有用。

回答by cyberbrain

As Oracle support for debian packages has gone quite a while ago, I suppose that you use the method of webupd8

由于Oracle对debian包的支持已经有一段时间了,我想你使用webupd8的方法

Go to their instructions I linked before and check if your configuration is still valid.

转到我之前链接的说明并检查您的配置是否仍然有效。

They also provide a method to install Java 8: Install Oracle Java 8 in Ubuntu(Debian instructions linked from there.)

他们还提供了一种安装 Java 8 的方法:在 Ubuntu 中安装 Oracle Java 8(从那里链接的 Debian 说明。)

Edit: I think that Oracle does not provide a public download of Java 7 anylonger - you would have to download it from the Java Archive. (http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html)

编辑:我认为 Oracle 不再提供 Java 7 的公共下载 - 您必须从 Java Archive 下载它。( http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html)

You could try to download the rpm package and use aliento convert it to a .deb package. And did you already consider updating to Java 8?

您可以尝试下载 rpm 包并将alien其转换为 .deb 包。您是否已经考虑更新到 Java 8?

回答by Garden Gnome

You can find the webupd8team ppa's online. The oracle-java7-installer has the version number "7u80+7u60arm-0~webupd8~1" I'm guessing this defect would occur for all the provided ubuntu versions!

您可以在网上找到webupd8team ppa。oracle-java7-installer 的版本号为“7u80+7u60arm-0~webupd8~1”,我猜所有提供的 ubuntu 版本都会出现这个缺陷!

Looking in one of the ppa's a few of the files directly reference the broken url identified by Meir Maor

查看 ppa 之一,其中一些文件直接引用了 Meir Maor 标识的损坏的 url

debian/oracle-java7-unlimited-jce-policy.postinst:PARTNER_URL=http://download.oracle.com/otn-pub/java/jce/7/$FILENAME
debian/oracle-java7-unlimited-jce-policy.config:PARTNER_URL=http://download.oracle.com/otn-pub/java/jce/7/$FILENAME
debian/oracle-java7-installer.config:   PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/7u80-b15/$FILENAME # Must be modified for each release!!!
debian/oracle-java7-installer.config:   PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/7u60-b19/$FILENAME # Must be modified for each release!!!
debian/oracle-java7-installer.postinst: PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/7u80-b15/$FILENAME # Must be modified for each release!!!
debian/oracle-java7-installer.postinst: PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/7u60-b19/$FILENAME # Must be modified for each release!!!

unfortunately I can't figure out how to lodge a defect with them (yet) but presumably this would be a quick fix

不幸的是,我无法弄清楚如何向他们提出缺陷(还)但大概这将是一个快速解决方案