Skip to content

Instantly share code, notes, and snippets.

@asaikali
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save asaikali/8859302 to your computer and use it in GitHub Desktop.

Select an option

Save asaikali/8859302 to your computer and use it in GitHub Desktop.
A way to setup Java 7 on RHEL systems by downloading them directly form the internet, installing java 7 then installing the unlimted crypto and adding JAVA_HOME to the environment
#!/bin/bash
#
# Trick for downloading jdk with wget from https://ivan-site.com/2012/05/download-oracle-java-jre-jdk-using-a-script/
#
JDK_UPDATE=51
set -e
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" http://download.oracle.com/otn-pub/java/jdk/7u$JDK_UPDATE-b13/jdk-7u$JDK_UPDATE-linux-x64.rpm -O jdk-7u$JDK_UPDATE-linux-x64.rpm
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" http://download.oracle.com/otn-pub/java/jce/7/UnlimitedJCEPolicyJDK7.zip -O UnlimitedJCEPolicyJDK7.zip
rpm -Uvh jdk-7u$JDK_UPDATE-linux-x64.rpm
JDK_DIR=/usr/java/jdk1.7.0_$JDK_UPDATE
unzip -o UnlimitedJCEPolicyJDK7.zip "*.jar" -d tmp
mv -f tmp/UnlimitedJCEPolicy/*.jar $JDK_DIR/jre/lib/security
rm -rf tmp/UnlimitedJCEPolicy
echo "export JAVA_HOME=$JDK_DIR" > /etc/profile.d/jdk.sh
rpm -V jdk-1.7.0_$JDK_UPDATE-fcs.x86_64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment