mercoledì 12 agosto 2015

Portable JDK 8

I'm back... I need to keep track of my IT adventures!

Now: what about a portable Java SE 8 that does not bungle your client paths, uh?

Step 1) Download the desired Java version:
             http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Step 2.1)  install 7zip

Step 2.2) open the JDK ".exe" file with 7-Zip. It contains a single file "tools.zip", which contains all the files we need.
                Extract the tools.zip to the desired JDK directory (in my case, on win, “C:\eclipse\jdk\”).

Step 3) unpack the "pack2000" files in order to obtain a collection of useful JAR files, using the following statement form command line in the new portable jdk home:

for /R %f in (.\*.pack) do @"D:\JavaJDK\bin\unpack200" -r -v -l "" "%f" "%~pf%~nf.jar"
 
Example:


C:\eclipse\jdk>for /R %f in (.\*.pack) do @"C:\eclipse\jdk\bin\unpack200" -r -v -l "" "%f" "%~pf%~nf.jar"
Unpacking from C:\eclipse\jdk\jre\lib\.\charsets.pack to \eclipse\jdk\jre\lib\charsets.jar
com.sun.java.util.jar.pack.unpack.log.file=
unpack.deflate.hint=(not set)
com.sun.java.util.jar.pack.unpack.remove.packfile=true
com.sun.java.util.jar.pack.verbose=1
com.sun.java.util.jar.pack.unpack.modification.time=(not set)
[ . . . ]

A total of 4974 files (of which 4670 are classes) were written to output.

C:\eclipse\jdk>cd bin

C:\eclipse\jdk\bin>java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) Client VM (build 25.51-b03, mixed mode)

C:\eclipse\jdk\bin>

The trick is done.