Skip to content

Instantly share code, notes, and snippets.

@mearns
Created December 29, 2015 15:08
Show Gist options
  • Save mearns/c394afe6c96a7d5f9186 to your computer and use it in GitHub Desktop.
Save mearns/c394afe6c96a7d5f9186 to your computer and use it in GitHub Desktop.
Download java installation packages for linux without a web browser
#!/bin/bash
# You could go to http://www.oracle.com/technetwork/java/javase/downloads/index.html
# And pick the file you want to download, but it's an interactive thing that requires you to
# click some buttons and accept the agreement. Doing that on a headless machine is a bit tricky.
# This script will do it for you.
#Configure which version to download.
export JAVA_VERSION_MAJOR=8
export JAVA_VERSION_MINOR=66
export JAVA_VERSION_BUILD=17
#Configure what to download. Options are 'jdk', 'jre', or 'server-jre'
export JAVA_PACKAGE=jdk
#Download the file.
curl -jLo java-${JAVA_PACKAGE}-${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}.tar.gz -H "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}-b${JAVA_VERSION_BUILD}/${JAVA_PACKAGE}-${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}-linux-x64.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment