Skip to content

Instantly share code, notes, and snippets.

@helkhalfi
Last active April 27, 2016 06:27
Show Gist options
  • Save helkhalfi/f7e35f5302b2be7e29b4 to your computer and use it in GitHub Desktop.
Save helkhalfi/f7e35f5302b2be7e29b4 to your computer and use it in GitHub Desktop.
From Hichame : this not my post, i copy/paste it in gist in case of issue on original post server => http://www.brucalipto.org/java/how-to-create-a-portable-jdk-1-dot-7-on-windows/
thanks to him for this job
How to Create a Portable JDK 1.7 on Windows
Published Dec 27th, 2013 | Comments
[Java logo] As a Java developer sometimes I need a version of Java Development Kit (JDK) that is not the one installed on my PC. Oracle Java installer on Windows does too many things that I cannot control (like changing the JVM used by browsers to run applets). As of this writing Java 7 is at version u45 and you can download it from here. Open the downloaded file with 7-zip (in my case was jdk-7u45-windows-i586.exe) and then open the tools.zip you find inside. Extract everything to a convenient path like C:\jdk-1.7u45. Now it is shell time so open a DOS console (Start->Run…->cmd) and type:
Create a portable JDK 1.7
> cd C:\jdk-1.7u45
> for /r %x in (*.pack) do C:\jdk-1.7u45\bin\unpack200 "%x" "%x.jar"
Now you are almost done but you need to rename some files:
Look for all files that ends with .pack.jar
> dir /B /S *.pack.jar
C:\jdk-1.7u45\jre\lib\charsets.pack.jar
C:\jdk-1.7u45\jre\lib\deploy.pack.jar
C:\jdk-1.7u45\jre\lib\javaws.pack.jar
C:\jdk-1.7u45\jre\lib\jfxrt.pack.jar
C:\jdk-1.7u45\jre\lib\jsse.pack.jar
C:\jdk-1.7u45\jre\lib\plugin.pack.jar
C:\jdk-1.7u45\jre\lib\rt.pack.jar
C:\jdk-1.7u45\jre\lib\ext\localedata.pack.jar
C:\jdk-1.7u45\lib\tools.pack.jar
Rename all these files removing the .pack part (eg.: rename charsets.pack.jar to charsets.jar):
Rename all files that ends with .pack.jar
> ren C:\jdk-1.7u45\jre\lib\charsets.pack.jar charsets.jar
> ren C:\jdk-1.7u45\jre\lib\deploy.pack.jar deploy.jar
> ren C:\jdk-1.7u45\jre\lib\javaws.pack.jar javaws.jar
> ren C:\jdk-1.7u45\jre\lib\jfxrt.pack.jar jfxrt.jar
> ren C:\jdk-1.7u45\jre\lib\jsse.pack.jar jsse.jar
> ren C:\jdk-1.7u45\jre\lib\plugin.pack.jar plugin.jar
> ren C:\jdk-1.7u45\jre\lib\rt.pack.jar rt.jar
> ren C:\jdk-1.7u45\jre\lib\ext\localedata.pack.jar localedata.jar
> ren C:\jdk-1.7u45\lib\tools.pack.jar tools.jar
Finally test you new portable JDK 1.7:
Test portable JDK 1.7
> .\bin\java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) Client VM (build 24.45-b08, mixed mode)
I hope this tutorial can help you… if you find errors please report them to me and I will correct as soon as possible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment