Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I just got a new amazon linux box and I'm trying to install jdk on it. These are the commands i followed but I am getting an error:

$ 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
share|improve this question

1 Answer 1

This is because attempting a wget is redirecting you to an HTML page, presumably demanding you accept their terms and conditions first. Running your wget command reveals this:

--2013-10-14 18:16:42--  http://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpm
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’

The important line is right here:

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

Looking at the README.md in the OpsCode java cookbook reveals the following:

IMPORTANT NOTE

As of 26 March 2012 you can no longer directly download the JDK from Oracle's 
website without using a special cookie. This cookbook uses that cookie to 
download the oracle recipe on your behalf <snipped>

But then looking in the oracle.rb recipe, you can see the following:

if tarball_url =~ /example.com/
  Chef::Application.fatal!("You must change the download link to your private repository. You can no longer download java directly from http://download.oracle.com without a web broswer")
end

This means that you need to install via apt/yum/whatever from a repository that has the latest JDK 7 package, or head over to the OpenJDK project and download from there.

share|improve this answer
    
Thanks. I was able to download the rpm with this command wget --no-cookies --header "Cookie: gpw_e24=xxx;" http://download.oracle.com/otn-pub/java/jdk/7u25-b15/jdk-7u25-linux-x64.rpm –  Anthony Oct 14 '13 at 23:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.