Skip to content

Instantly share code, notes, and snippets.

@theodson
Last active June 14, 2017 07:56
Show Gist options
  • Save theodson/ed84e9c80c97ca8af53a to your computer and use it in GitHub Desktop.
Save theodson/ed84e9c80c97ca8af53a to your computer and use it in GitHub Desktop.
# http://stackoverflow.com/questions/10268583/downloading-java-jdk-on-linux-via-wget-is-shown-license-page-instead
# default is JDK 8
rpmfile="http://download.oracle.com/otn-pub/java/jdk/8u73-b02/jdk-8u73-linux-x64.rpm"
rpmfile="http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm"
archfile="http://download.oracle.com/otn-pub/java/jdk/8u73-b02/jdk-8u73-linux-x64.tar.gz"
archfile="http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz"
if [ "$2" == '6' ]; then
rpmfile="http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64-rpm.bin"
archfile="http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin"
fi
if [ "$2" == '7' ]; then
rpmfile="http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.rpm"
archfile="http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz"
fi
if [ "$1" == 'rpm' ]; then
getfile=$rpmfile
else
getfile=$archfile
fi
filename="$(echo $getfile | rev | cut -d "/" -f -1 | rev)"
wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" "$getfile" -O $filename
@theodson
Copy link
Author

theodson commented Mar 7, 2016

auto install using

Get tar.gz
curl https://gist.githubusercontent.com/theodson/ed84e9c80c97ca8af53a/raw/b6f35bf5092955e37117f0a80da89be09321594b/getOracleJDK.sh | bash -

Get RPM
curl https://gist.githubusercontent.com/theodson/ed84e9c80c97ca8af53a/raw/b6f35bf5092955e37117f0a80da89be09321594b/getOracleJDK.sh | bash -s "rpm"

or
curl https://gist.githubusercontent.com/theodson/ed84e9c80c97ca8af53a/raw/b6f35bf5092955e37117f0a80da89be09321594b/getOracleJDK.sh | bash /dev/stdin "rpm"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment