Skip to content

Instantly share code, notes, and snippets.

@miy4mori
Created July 19, 2018 19:00
Show Gist options
  • Save miy4mori/199c4e8283416da07f5a24ed547d935d to your computer and use it in GitHub Desktop.
Save miy4mori/199c4e8283416da07f5a24ed547d935d to your computer and use it in GitHub Desktop.
Get JDK from latest version of JDK from Oracle without install
@echo off
set tool7z="%ProgramFiles%\7-Zip\7z.exe"
set jdk_exe="%~dpnx1"
call :INFO "Extracting '.rsrc/1033/JAVA_CAB10/111'"
%tool7z% e %jdk_exe% .rsrc/1033/JAVA_CAB10/111
call :INFO "Extracting '111'"
%tool7z% x 111
call :WARN "Removing '111'"
del 111
call :INFO "Extracting 'tools.zip'"
%tool7z% x tools.zip -o%~dpn1
call :WARN "Removing 'tools.zip'"
del tools.zip
call :INFO "Extracting '*.pack'"
cd %~dpn1
for /r %%x in (*.pack) do .\bin\unpack200 -r "%%x" "%%~dx%%~px%%~nx.jar"
cd ..
call :INFO "Extracting '.rsrc/1033/JAVA_CAB9/110'"
%tool7z% e %jdk_exe% .rsrc/1033/JAVA_CAB9/110
call :INFO "Extracting '110'"
%tool7z% x 110 -o%~dpn1
call :WARN "Removing '110'"
del 110
call :INFO "Done."
goto :eof
:INFO
echo ================================================================================
echo INFO:%~1
echo ================================================================================
goto :eof
:WARN
echo ================================================================================
echo WARN:%~1
echo ================================================================================
goto :eof
@miy4mori
Copy link
Author

miy4mori commented Jul 19, 2018

It requires access on the path to 7zip, example: %ProgramFiles%\7-Zip\7z.exe.

C:\Users\miy4mori\Downloads\demo
# ll
total 207632
drwxr-xr-x 1 miy4mori 197609         0 7月  20 03:01 ./
drwxr-xr-x 1 miy4mori 197609         0 7月  20 03:01 ../
-rwxr-xr-x 1 miy4mori 197609 212582768 7月  19 18:28 jdk-8u181-windows-x64.exe*

C:\Users\miy4mori\Downloads\demo
# unpack jdk-8u181-windows-x64.exe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment