Skip to content

Instantly share code, notes, and snippets.

@ashrithr
Last active August 22, 2016 05:02
Show Gist options
  • Save ashrithr/5874684640d04b293bd9 to your computer and use it in GitHub Desktop.
Save ashrithr/5874684640d04b293bd9 to your computer and use it in GitHub Desktop.
wget oracle jdk
# RPM
wget --no-check-certificate \
--no-cookies \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
http://download.oracle.com/otn-pub/java/jdk/7u45-b18/jdk-7u45-linux-x64.rpm \
-O jdk-7u45-linux-x64.rpm
# TAR GZ
wget --no-check-certificate \
--no-cookies \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
http://download.oracle.com/otn-pub/java/jdk/7u45-b18/jdk-7u45-linux-x64.tar.gz \
-O jdk-7u45-linux-x64.tar.gz
#
# NOTE:
#
# Make sure that you have the correct download url from
# http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
# cURL alternate
# where,
# -L | --location; Required for cURL to redirect through all the mirrors
# -C / --continue-at -; cURL requires the dash (-) in the end
# -O; Required for cURL to save files
# -b / --cookie "oraclelicense=accept-securebackup-cookie"; same as -H/--header "Cookie: ..."
curl -L -C - -b "oraclelicense=accept-securebackup-cookie" \
-O http://download.oracle.com/otn-pub/java/jdk/8u20-b26/jdk-8u20-linux-x64.tar.gz
# Optional, using alternatives to update the JDK to use
# add's a symbolic link to the Oracle JDK installation so that your system uses the Oracle JDK instead of the OpenJDK (if installed)
alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_45/bin/java 200000
# If there are more than on version of java, then tell alternatives to switch (enter approprate number matching the latest installation of JDK)
alternatives --config java
# Update the JAVA_HOME and PATH so that users get the proper installation
cat > /etc/profile.d/java_home.sh <<EOF
export JAVA_HOME=/usr/java/latest
export PATH="$PATH:${JAVA_HOME}/bin"
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment