Skip to content

Instantly share code, notes, and snippets.

@valtoni
Created April 26, 2019 18:20
Show Gist options
  • Save valtoni/8ebdf424b3578320d94d8e42c76bab7e to your computer and use it in GitHub Desktop.
Save valtoni/8ebdf424b3578320d94d8e42c76bab7e to your computer and use it in GitHub Desktop.
@echo off
SETLOCAL
if "%1%"=="" (
echo Please, fill JDK exe installer as first parameter
exit /B
)
set z7="C:\Program Files\7-Zip\7z.exe"
REM Decompress executable installer
REM echo "Uncompressing %1..."
REM %z7% x %1
REM set CUR_DIR=%~dp0
REM set JDK_FILE=%1
REM FOR %%i IN ("%CUR_DIR%\%JDK_FILE%") DO (
REM set JDK_DIR=%%~ni
REM )
REM Creating target jdk
echo Creating %JDK_DIR%
mkdir %JDK_DIR%
REM Tools
echo "Decompress tools..."
%z7% e %JDK_FILE% .rsrc\1033\JAVA_CAB10\111
%z7% x 111
%z7% x tools.zip -o%JDK_DIR%
del 111
del tools.zip
REM JDK Source
echo "Decompress jdk source..."
%z7% e %JDK_FILE% .rsrc\1033\JAVA_CAB7\108
%z7% x 108 -o%JDK_DIR%
del 108
REM Unpack packed files
echo "Unpacking files..."
for /r %%i in (*.pack) do (
%JDK_DIR%\bin\unpack200 -r "%%i" "%%~di%%~pi%%~ni.jar"
)
echo Blessed! Your jdk is %JDK_DIR%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment