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?