Download Oracle Java via wget
If you want or have to download Java from Oracle’s web site, you might know that you have to accept the “Oracle Binary Code License Agreement for Java SE” to activate the download link. If you have to download the binary from a computer without a browser, you get some problems: how to click on something that needs to accessed by a browser? What happens when you click on the link (technically) is that a cookie is being set. The download site checks for that cookie and when it is set, allows you to download the binary.
With knowing that, you can use wget to download Java without having to actually click on the checkbox. Just send the cookie with wget. The command for downloading Java SE 8 u51 with wget is:
Command: wget –header “Cookie: oraclelicense=accept-securebackup-cookie” http://download.oracle.com/otn-pub/java/jdk/8u51-b16/jdk-8u51-linux-x64.tar.gz
Of course, you still have to accept Oracles license agreement.
Download resources from SAP Cloud for your CI job | It`s full of stars! · June 17, 2018 at 09:46
[…] command will not download the tool, but a web site. Some may know that this is very close to how Oracle protected it’s Java download. And the “solution” here is the same: send the right cookie via […]