Source : http://stackoverflow.com/questions/10268583/how-to-automate-download-and-installation-of-java-jdk-on-linux

UPDATED FOR JDK 8u45

RPM:

 wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.rpm

TAR GZ:

 wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u40-b26/jdk-8u40-linux-x64.tar.gz

RPM using curl:

 curl -v -j -k -L -H "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.rpm > jdk-8u45-linux-x64.rpm

curl can be used in place of wget.

UPDATED ANSWER ON 6th September 2014 (JDK 7u67)

I am updating this answer to take into account the fact that Oracle has changed their cookie policy. Thanks to Det for pointing out a simpler method than what I had originally specified.

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u67-linux-x64.tar.gz

Once again, make sure you specify the correct URL for the version you are downloading. You can find the URL here: Oracle JDK download site

ORIGINAL ANSWER FROM 9th June 2012

If you are looking to download the Oracle JDK from the command line using wget, there is a workaround. Run the wget command as follows:

wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-x64.tar.gz"

Be sure to replace the download link with the correct one for the version you are downloading.

Laisser un commentaire

Votre adresse courriel ne sera pas publiée. Les champs obligatoires sont indiqués avec *