Skip to content

Instantly share code, notes, and snippets.

@jrnewell
Created November 23, 2014 22:16
Show Gist options
  • Save jrnewell/a74b4924147c7ea26e51 to your computer and use it in GitHub Desktop.
Save jrnewell/a74b4924147c7ea26e51 to your computer and use it in GitHub Desktop.
Extract JDK.exe into a portable folder (cygwin/windows)
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "usage: $0 <jdk.exe>"
echo "result will be in ./jdk"
exit 1
fi
JDK_EXE=$1
cabextract "$JDK_EXE" -d jdk_extract
cd jdk_extract
unzip tools.zip -d tools/
mv COPYRIGHT tools
mv src.zip tools
cd tools
find . -type f \( -name "*.exe" -o -name "*.dll" \) -exec chmod u+rwx {} \;
find . -type f -name "*.pack" | while read eachFile; do
echo "Unpacking $eachFile ...";
./bin/unpack200.exe $eachFile ${eachFile%.pack}.jar;
rm $eachFile;
done
cd ..
mv tools ../jdk
cd ..
rm -rf jdk_extract
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment