Skip to content

Instantly share code, notes, and snippets.

@andygock
Created June 2, 2017 09:29
Show Gist options
  • Save andygock/efeebd51807de116b3e1e76bdc18b31e to your computer and use it in GitHub Desktop.
Save andygock/efeebd51807de116b3e1e76bdc18b31e to your computer and use it in GitHub Desktop.
Bash script: Download latest JRE offline installer
#!/bin/bash
#
# Download latest JRE for Windows x64
page="http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html"
# Edit this for other platforms
url=$(curl -s "$page" \
| grep "downloads\[.*jre-.*filepath" | cut -d ',' -f 3 | cut -d '"' -f 4 | grep "x64.exe$")
wget --no-cookies --no-check-certificate --header \
"Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \
"$url" -O "${url##*/}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment