CentOS安装JDK、JRE遇到open of <html> failed: No such

前端之家收集整理的这篇文章主要介绍了CentOS安装JDK、JRE遇到open of <html> failed: No such前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

当我们从Oracle上accept license后右键复制链接地址,然后在centOS上使用wget下载之后,rpm安装时出现

open of <html> Failed: No such file or directory

错误如下

$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.11.90) (amazon-62.1.11.11.90.55.amzn1-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12,mixed mode)

$ wget http://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpm

$ ls
jdk-7u1-linux-i586.rpm

$ ls -al jdk-7u1-linux-i586.rpm 
 -rw-rw-r-- 1 username username 5307 Mar 20  2012 jdk-7u1-linux-i586.rpm

$ sudo rpm -i jdk-7u1-linux-i586.rpm 
error: open of <html> Failed: No such file or directory
error: open of <head> Failed: No such file or directory
error: open of <title>Unauthorized Failed: No such file or directory
error: open of Request</title> Failed: No such file or directory
error: open of <Meta Failed: No such file or directory
error: open of NAME=ROBOTS Failed: No such file or directory

这时候我们再看下下载的信息:

Resolving download.oracle.com... 23.62.239.25,23.62.239.8
Connecting to download.oracle.com|23.62.239.25|:80... connected.
HTTP request sent,awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpm [following]
--2013-10-14 18:16:43--  https://edelivery.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpm
Resolving edelivery.oracle.com... 23.65.6.140
Connecting to edelivery.oracle.com|23.65.6.140|:443... connected.
HTTP request sent,awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/errors/download-fail-1505220.html [following]
--2013-10-14 18:16:45--  http://download.oracle.com/errors/download-fail-1505220.html
Connecting to download.oracle.com|23.62.239.25|:80... connected.
HTTP request sent,awaiting response... 200 OK
Length: 5307 (5.2K) [text/html]
Saving to: ‘jdk-7u1-linux-i586.rpm’

注意看这里:

Length: 5307 (5.2K) [text/html]

这是因为Oracle上的链接地址并非最终下载地址,下载的只是一个HTML文档,但被命名为**.rpm所以会引起困惑。

如果下载tar.gz遇到不能解压的情况,也是相同原因。

解决方法

定位到真实的下载地址,比如使用firefox默认下载

在Oracle网站上直接【点击下载】

然后再【复制下载链接

使用wget 与这个链接 就能获取到真正的安装包(解压包)

因为下载链接加上一个Oracle的时间戳,所以有下载的时间限制。

这时文件名称不是我们需要的.rpm,这时候通过mv oldpackage newpackage来重命名

然后就可以安装使用了

参考资料:http://serverfault.com/questions/545982/installing-jdk-on-amazon-linux-Box-gives-error-open-of-html-Failed-no-such-f

原文链接:https://www.f2er.com/centos/382129.html

猜你在找的CentOS相关文章