출처 : http://www.brucalipto.org/java/how-to-create-a-portable-jdk-1-dot-7-on-windows/

JDK6 버전 Portable 다운로드 : http://sourceforge.net/projects/portableapps/files/Java%20Portable/


- JDK 1.7 Portable

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
1
2
> 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
1
2
3
4
5
6
7
8
9
10
> 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
1
2
3
4
5
6
7
8
9
> 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
1
2
3
4
> .\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.


=========================================================================================================
=========================================================================================================

- JDK 1.8


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 8 is not yet available for general consumption but you can get an early access release here. Open the downloaded file with 7-zip and then open the tools.zip you find inside. Extract everything to a convenient path like C:\jdk-1.8-ea. Now it is shell time so open a DOS console (Start->Run…->cmd) and type:

Create a portable JDK 1.8
1
2
> cd C:\jdk-1.8-ea
> for /r %x in (*.pack) do C:\jdk-1.8-ea\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
1
2
3
4
5
6
7
8
9
10
> dir /B /S *.pack.jar
C:\jdk-1.8-ea\jre\lib\charsets.pack.jar
C:\jdk-1.8-ea\jre\lib\deploy.pack.jar
C:\jdk-1.8-ea\jre\lib\javaws.pack.jar
C:\jdk-1.8-ea\jre\lib\jsse.pack.jar
C:\jdk-1.8-ea\jre\lib\plugin.pack.jar
C:\jdk-1.8-ea\jre\lib\rt.pack.jar
C:\jdk-1.8-ea\jre\lib\ext\jfxrt.pack.jar
C:\jdk-1.8-ea\jre\lib\ext\localedata.pack.jar
C:\jdk-1.8-ea\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
1
2
3
4
5
6
7
8
9
> ren C:\jdk-1.8-ea\jre\lib\charsets.pack.jar charsets.jar
> ren C:\jdk-1.8-ea\jre\lib\deploy.pack.jar deploy.jar
> ren C:\jdk-1.8-ea\jre\lib\javaws.pack.jar javaws.jar
> ren C:\jdk-1.8-ea\jre\lib\jsse.pack.jar jsse.jar
> ren C:\jdk-1.8-ea\jre\lib\plugin.pack.jar plugin.jar
> ren C:\jdk-1.8-ea\jre\lib\rt.pack.jar rt.jar
> ren C:\jdk-1.8-ea\jre\lib\ext\jfxrt.pack.jar jfxrt.jar
> ren C:\jdk-1.8-ea\jre\lib\ext\localedata.pack.jar localedata.jar
> ren C:\jdk-1.8-ea\lib\tools.pack.jar tools.jar

Finally test you new portable JDK 1.8:

Test portable JDK 1.8
1
2
3
4
C:\jdk-1.8-ea>.\bin\java -version
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b121)
Java HotSpot(TM) Client VM (build 25.0-b63, 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.


+ Recent posts