6/11/2012

Extracting the JDK from Oracle's Windows installer .exe

The Oracle JDK downloads for Windows are only offered as EXE files, or install executables.  Unfortunately, for some of us, we don't want to install because we want to develop with more than one version and/or we do not have the rights on our computer to install software.

1. Install 7zip.  Open the installer EXE in 7Zip File Manager, either by using Open with... or changing the extension of the file to .7z.

You can browse the file in 7zip by using Open Inside.  Browse through the exe until you find two files, src.zip and tools.zip.  Extract those to a directory you want to store the JDK in.

2.Unzip only the tools.zip file.  Leave the src.zip file as-is.  Once the tools.zip is unzipped, you'll notice that all of the normal JDK files are there.  Or, at least, almost.

3. Look for any files that end in .pack and unpack them to .jar.  The bin directory that was just unzipped from tools.zip has a utility called unpack200.exe.   Use this to unpack the pack files to jars and you are done.

Set your JAVA_HOME to the new directory when you want to use it, and it should work fine.

Note: I'll pretty this blog entry up later.