Monday, March 11, 2019

Portable Java JDK on Windows


Prerequisite: Install 7-Zip file archiver :- https://www.7-zip.org/


1. Download the Java 8 SDK for Windows from Oracle. You will get a file named like jdk-8u101-windows-x64.exe.
Url- https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

2. Open the downloaded file with 7-Zip, which will show a a list of files and folders.
 

3. Open folder ‘.rsrc’ (select and double click this folder within 7-Zip).
4. Open folder ‘1033’ (or the folder of greatest size).
 


5. Open folder ‘JAVA_CAB10’ (or the folder of greatest size).
6. Open file ‘111’ (or the folder of greatest size).
 


7. Open file ‘tools.zip’.
8. Extract its contents to a directory where own write permissions, for example: C:\Users\Daniel\Documents\jdk-8u102-x64. To prevent issues, I recommend a directory without spaces.
9. From within this directory, search for all .pack files and extract them using unpack2000.exe command line tool found in the bin subdirectory. Following windows prompt command does the trick when executed from within the extracted directory: for /r %i in (*.pack) do .\bin\unpack200.exe %i %~pi%~ni.jar

How I Did it
============

.\bin\unpack200.exe E:\Vishal\SelfStudy\java\eclipse\jre\lib\ext\localedata.pack  "E:\Vishal\SelfStudy\java\eclipse\jre\lib\ext\localedata.jar"
.\bin\unpack200.exe E:\Vishal\SelfStudy\java\eclipse\jre\lib\charsets.pack  "E:\Vishal\SelfStudy\java\eclipse\jre\lib\charsets.jar"
.\bin\unpack200.exe E:\Vishal\SelfStudy\java\eclipse\jre\lib\javaws.pack  "E:\Vishal\SelfStudy\java\eclipse\jre\lib\javaws.jar"
.\bin\unpack200.exe E:\Vishal\SelfStudy\java\eclipse\jre\lib\deploy.pack  "E:\Vishal\SelfStudy\java\eclipse\jre\lib\deploy.jar"
.\bin\unpack200.exe E:\Vishal\SelfStudy\java\eclipse\jre\lib\jsse.pack  "E:\Vishal\SelfStudy\java\eclipse\jre\lib\jsse.jar"
.\bin\unpack200.exe E:\Vishal\SelfStudy\java\eclipse\jre\lib\rt.pack  "E:\Vishal\SelfStudy\java\eclipse\jre\lib\rt.jar"
.\bin\unpack200.exe E:\Vishal\SelfStudy\java\eclipse\jre\lib\plugin.pack  "E:\Vishal\SelfStudy\java\eclipse\jre\lib\plugin.jar"
.\bin\unpack200.exe E:\Vishal\SelfStudy\java\eclipse\lib\tools.pack  "E:\Vishal\SelfStudy\java\eclipse\lib\tools.jar"



The downloaded .exe file also contains the JDK sources. Navigating through the folders ‘.rsrc’, ‘1033’, ‘JAVA_CAB9’, ‘110’.

Alternate Method
=============================

These scripts can be run as:

jdk-extract path_to_install.exe
or
jdk-extract-pre-7.0.bat path_to_installer.bat


And now on to the actual the code:
File Name :- jdk-extract.bat

@echo off
REM This script will extract JDK tools from installers, without polluting Windows environment.
REM You need the pristine installers from Oracles website to extract all the data
setlocal
SET CWD=%CD%
SET FILE=%~f1
SET DEST=%~dpn1
echo DEST=%DEST% FILE=%FILE% CWD=%CWD%
md %DEST%
REM Used e here instead of x to keep structure flat
7z e -o"%DEST%"  -y "%FILE%" tools.zip
cd "%DEST%"
7z x -y tools.zip
del tools.zip
for /r %%x in (*.pack) do call :unpack2000 "%%x"
cd %CWD%
goto end
:unpack2000
%DEST%\bin\unpack200 -r %1 "%~dpn1.jar"
goto:eof
:end
echo Extracted %FILE% to %DEST%

2 comments:

  1. Oracle E-Business Suite: Portable Java Jdk On Windows >>>>> Download Now

    >>>>> Download Full

    Oracle E-Business Suite: Portable Java Jdk On Windows >>>>> Download LINK

    >>>>> Download Now

    Oracle E-Business Suite: Portable Java Jdk On Windows >>>>> Download Full

    >>>>> Download LINK Pa

    ReplyDelete
  2. Oracle E-Business Suite: Portable Java Jdk On Windows >>>>> Download Now

    >>>>> Download Full

    Oracle E-Business Suite: Portable Java Jdk On Windows >>>>> Download LINK

    >>>>> Download Now

    Oracle E-Business Suite: Portable Java Jdk On Windows >>>>> Download Full

    >>>>> Download LINK ym

    ReplyDelete