Skip to content

Instantly share code, notes, and snippets.

@4ndrew
Created September 23, 2014 13:58
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 4ndrew/f9dca61cedf0e8340b54 to your computer and use it in GitHub Desktop.
Save 4ndrew/f9dca61cedf0e8340b54 to your computer and use it in GitHub Desktop.
Extract JDK from Windows installer
#!/bin/sh
# usage example: prepareJdk.sh jdk-7u67-windows-x64.exe (result will be in jdk/)
# Requires: p7zip, unzip
JDK_EXE=$1
7z x -ojdk "$JDK_EXE"
unzip jdk/tools.zip -d jdk/
find jdk/ -type f \( -name "*.exe" -o -name "*.dll" \) -exec chmod u+rwx {} \;
rm jdk/tools.zip
find jdk/ -type f -name "*.pack" | while read eachFile; do
echo "Unpacking $eachFile ...";
./jdk/bin/unpack200.exe $eachFile ${eachFile%.pack}.jar;
rm $eachFile;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment