-
-
Save smaudet/2cab5c8188ff0c2ae3c00bdb9499b53f to your computer and use it in GitHub Desktop.
@echo off | |
set vernum=8u144 | |
set jdkbasename=jdk8 | |
set "tool7z=C:\Program Files\7-Zip\7z.exe" | |
set "jdk_exe=%1" | |
echo Extracting '.rsrc/1033/JAVA_CAB10/111' | |
%tool7z% e %jdk_exe% .rsrc/1033/JAVA_CAB10/111 | |
rem :: %tool7z% e %jdk_exe% .rsrc/1033/version.txt | |
echo Extracting '111' | |
extrac32 111 | |
echo Removing '111' | |
del 111 | |
echo Extracting 'tools.zip' | |
%tool7z% x tools.zip -otools | |
echo Removing 'tools.zip' | |
del tools.zip | |
echo Extracting '*.pack' | |
cd tools | |
for /r %%x in (*.pack) do .\bin\unpack200 -r "%%x" "%%~dx%%~px%%~nx.jar" | |
echo Copying to %jdkbasename%-%vernum% | |
mkdir ..\%jdkbasename%-%vernum% | |
xcopy .\* ..\%jdkbasename%-%vernum% /Y /E | |
cd .. | |
echo Deleting tools directory | |
del /Q tools | |
echo Done - JDK in %jdkbasename%-%vernum% |
Thanks for this script.
On Win10 and using a path with spaces on D:, I had to make these changes for it to work:
Line 4: set tool7z="PATH_TO_7z\7z.exe"
Line5: set jdk_exe="%1"
Line 34: rd /s /q tools
In short, del would never delete folder "tools" and I don't know about that SET VAR syntax with both the var and the value on quotes, I had to put them as normal (only value on quotes because of spaces, if any) for it to work.
Also have you checked Java 9? Apparently there is only a "tools.zip" inside the EXE and everything's already unpacked so no need for scripts? If you can take a look lemme know.
@TehPsychedelic No problem!
Feel free to fork and create a new version.
Yeah I don't know why the set was done that way, it must have been an older version of windows (10) I was using. I went looking for this myself and it no longer works unless you apply your changes. Also there was no user manual when I came to this page, you should put your jdk exes in a separate directory e.g.:
Directory of C:\software\jdks
11/26/2020 02:23 PM
.11/26/2020 02:23 PM ..
11/26/2020 01:43 PM 212,582,768 jdk-8u181-windows-x64.exe
11/20/2020 02:27 PM 161,982,088 jdk-8u271-windows-i586.exe
11/26/2020 01:57 PM jdk8-8u144
Otherwise it seems like there is some weird functionality where it will copy everything else in your folder into the new jdk8-8u144 directory...
Added better unpack logic.