Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wget/curl download of Oracle Java 7 SDK from the Oracle Archive page

Tags:

java

curl

wget

There are plenty of posts on StackOverflow and other communities (AskUbuntu, Unix & Linux etc.) which provide advice on how to use wget or cUrl to automate downloading a Java distribution from the Oracle website. They all involve sending a cookie which pretends that one accepted the license agreement which one usually has to to manually before the real download link appears.

However, none of these work for me when trying to download Java 7 SDK which recently has been moved to the Oracle Archive page.

If I go to this page, accept the license agreement manually and then copy a download link, it looks like this:

http://download.oracle.com/otn/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz

Note that it has otn in the middle while all the other posts are about URLs which are stored underotn-pub.

Using the usual way that worked for the otn-pub links looks like this:

wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=a" http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz

However, this does not work for the otn type of URL. Instead, wget returns:

--2017-05-23 12:11:12--  http://download.oracle.com/otn/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 92.122.214.233, 92.122.214.217
Connecting to download.oracle.com (download.oracle.com)|92.122.214.233|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/akam/otn/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz [following]
--2017-05-23 12:11:12--  https://edelivery.oracle.com/akam/otn/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.0.39.115, 2a02:26f0:8f:29a::2d3e
Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.0.39.115|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://login.oracle.com/pls/orasso/orasso.wwsso_app_admin.ls_login?Site2pstoreToken=v1.2~CA55CD32~5B4FBD9FD4FC906722CB92CC3F7FA417B904138FD53F875C3FEFDF932EC5928D866C8B39EACAA55F28099E034BAC612F869C90A39B20E322E380F4A006B9668EAD35323A1C548EAD5D03EE8D6C772A88C049F024986DC6CCF546B00D347731F76BE786B96F0041610DEE7B6B4EAC27DCBE558B151B032973F065FC0367918B72DBCAB4B7FC920BAC4C13E820DFFE1761C5C473B6E0A4F0E94FABACDB40F02AD6B2BAB1D3F57371B14048557A0291AC3F12C73A30CAF4AAEB8A545475300A1ABBD60E2BF27FB1B11BC47DE91D0E918E04E4C4663632E98752BBC07671BBD21E7C6F73D78A8A66254579EC63B99716D999 [following]
--2017-05-23 12:11:12--  https://login.oracle.com/pls/orasso/orasso.wwsso_app_admin.ls_login?Site2pstoreToken=v1.2~CA55CD32~5B4FBD9FD4FC906722CB92CC3F7FA417B904138FD53F875C3FEFDF932EC5928D866C8B39EACAA55F28099E034BAC612F869C90A39B20E322E380F4A006B9668EAD35323A1C548EAD5D03EE8D6C772A88C049F024986DC6CCF546B00D347731F76BE786B96F0041610DEE7B6B4EAC27DCBE558B151B032973F065FC0367918B72DBCAB4B7FC920BAC4C13E820DFFE1761C5C473B6E0A4F0E94FABACDB40F02AD6B2BAB1D3F57371B14048557A0291AC3F12C73A30CAF4AAEB8A545475300A1ABBD60E2BF27FB1B11BC47DE91D0E918E04E4C4663632E98752BBC07671BBD21E7C6F73D78A8A66254579EC63B99716D999
Resolving login.oracle.com (login.oracle.com)... 209.17.4.8
Connecting to login.oracle.com (login.oracle.com)|209.17.4.8|:443... connected.
HTTP request sent, awaiting response... 401 Authorization Required

Username/Password Authentication Failed.

Looks like either they changed something regarding the authentication or it never worked before for links from the Oracle Archive page (never tried that before).

Any idea how I can download the most recent Oracle Java 7 SDK .tar.gz archive using wget or cUrl or similar?

like image 444
Dirk Avatar asked May 23 '17 10:05

Dirk


People also ask

How do I download an older version of Java 7?

How can I download an older versions of Java? Visit the Java Archive Download Page to get other versions of Java. We recommended installing the latest version of Java from java.com.

Can I download Java 7?

Java SE 7 Archive Downloads Go to the Oracle Java Archive page. Thank you for downloading this release of the JavaTM Platform, Standard Edition Development Kit (JDKTM). The JDK is a development environment for building applications, applets, and components using the Java programming language.


4 Answers

Oracle doesn't allow download from archive link without login into the portal and also its not recommendable to use jdk from archive links.

Check this link for more info: http://www.oracle.com/technetwork/java/javase/archive-139210.html

like image 109
Shruthi C.J Avatar answered Sep 20 '22 06:09

Shruthi C.J


This curl command works for me:

curl -v -O -L -b oraclelicense=accept-securebackup-cookie http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-i586.rpm

options:

  • -v - just display additional info and HTTP headers on STDERR (you can skip this) or use -s for silent run
  • -O - save response to disk (instead of sending it to STDOUT) or use -o filename to specify another path
  • -L - follow redirects
  • -b - enable cookie engine and pass in initial cookie oraclelicense=accept-securebackup-cookie

The URL is lifted straight from the Oracle JDK download page

like image 41
kixx Avatar answered Sep 19 '22 06:09

kixx


wget has worked with the otn-pub link up until recently.It does seem that Oracle has changed something.

The closest workaround is to wget from another site that host it

wget http://ftp.osuosl.org/pub/funtoo/distfiles/oracle-java/jdk-7u80-linux-x64.tar.gz
like image 41
TGKL Avatar answered Sep 22 '22 06:09

TGKL


The oracle site asks you to login if you try to download JDK 7 from their archive. Hence the issue with the curl and wget. This is a recent change hope they can change this.

Note: Oracle has changed their licensing policy so check that before you move ahead. Your JDK may not be free anymore

like image 22
Arun Ganesan Avatar answered Sep 21 '22 06:09

Arun Ganesan