Anna
Anna

Reputation: 63

How to download jdk8 via PowerShell and accept the Oracle Binary Code License Agreement

I'm trying to download JDK8 on Windows Server 2016 Core using Start-BitsTransfer.

When executing the command (shown at the picture) I get a redirection error. Not accepting the license can also be an issue, how can I accept the license?

Redirection Error

Upvotes: 1

Views: 628

Answers (1)

prunge
prunge

Reputation: 23248

The Chocolatey script that downloads the JDK (expand tools\common.ps1) uses cookies to accept the license:

$dummy = $client.Headers.Add('Cookie', 'gpw_e24=http://www.oracle.com; oraclelicense=accept-securebackup-cookie')

That does not seem possible to do with Start-BitsTransfer since it doesn't have fine-grained control over things like HTTP headers, but System.Net.WebClient does through the Headers property.

So if you can use webclient instead of Start-BitsTransfer, do that.

Upvotes: 2

Related Questions