Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wendelhp/d6060d9254a8d5516c89e6cc168b46b2 to your computer and use it in GitHub Desktop.
Save wendelhp/d6060d9254a8d5516c89e6cc168b46b2 to your computer and use it in GitHub Desktop.
Install UnlimitedJCEPolicyJDK7.zip on RHEL/CentOS
#!/usr/bin/env bash
if [[ -z "$JAVA_HOME" ]]; then
echo "[x] JAVA_HOME is unset. You should fix this before."
exit 1
fi
cd /tmp
wget \
--no-cookies \
--no-check-certificate \
--header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \
-O UnlimitedJCEPolicyJDK7.zip \
http://download.oracle.com/otn-pub/java/jce/7/UnlimitedJCEPolicyJDK7.zip
jar xvf UnlimitedJCEPolicyJDK7.zip
# Copy them to an alternate location and use update-alternatives so they don't
# get overwritten when Java is updated
mkdir -p /usr/lib/jvm-private/jdk7/jce/unrestricted
/bin/cp -f UnlimitedJCEPolicy/local_policy.jar /usr/lib/jvm-private/jdk7/jce/unrestricted
/bin/cp -f UnlimitedJCEPolicy/US_export_policy.jar /usr/lib/jvm-private/jdk7/jce/unrestricted
update-alternatives \
--install \
$JAVA_HOME/lib/security/local_policy.jar \
jce_1.7.0_oracle_local_policy.x86_64 \
/usr/lib/jvm-private/jdk7/jce/unrestricted/local_policy.jar \
900000 \
--slave \
$JAVA_HOME/lib/security/US_export_policy.jar \
jce_1.7.0_oracle_us_export_policy.x86_64 \
/usr/lib/jvm-private/jdk7/jce/unrestricted/US_export_policy.jar
rm -rf UnlimitedJCEPolicy UnlimitedJCEPolicyJDK7.zip
@bmaupin
Copy link

bmaupin commented Apr 25, 2017

I just updated mine to work on RHEL 7 in case you're interested:
https://gist.github.com/bmaupin/4396be4bb29c5ad440b6

I also created one for Java 8:
https://gist.github.com/bmaupin/87631863d55e2accc05ca7759247f887

@wendelhp
Copy link
Author

I really appreciate. Did fews improvement. Hope you like. Thank you

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