Add JRE auto-download to launcher
Launch-StudioBridge.bat now checks for portable-dist\jre\bin\java.exe on startup. If missing (e.g. fresh clone), it automatically downloads Temurin 21.0.11+10 LTS JRE for Windows x64 (~47 MB) from GitHub and extracts it into portable-dist\jre\ before starting StudioBridge.
This commit is contained in:
@@ -16,13 +16,58 @@ set "ROOTDIR=%~dp0"
|
||||
REM Set the path to the portable-dist folder
|
||||
set "PORTABLE=%ROOTDIR%portable-dist"
|
||||
|
||||
REM Check if StudioBridge.bat exists
|
||||
if not exist "%PORTABLE%\StudioBridge.bat" (
|
||||
echo ERROR: Could not find portable-dist\StudioBridge.bat
|
||||
echo Please make sure the portable-dist folder exists in:
|
||||
echo %PORTABLE%
|
||||
REM ---------------------------------------------------------------------------
|
||||
REM JRE auto-download (Temurin 21 LTS for Windows x64)
|
||||
REM ---------------------------------------------------------------------------
|
||||
set "JRE_DIR=%PORTABLE%\jre"
|
||||
set "JRE_EXE=%JRE_DIR%\bin\java.exe"
|
||||
set "JRE_ZIP=%TEMP%\temurin21-jre.zip"
|
||||
set "JRE_URL=https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%%2B10/OpenJDK21U-jre_x64_windows_hotspot_21.0.11_10.zip"
|
||||
set "JRE_FOLDER=jdk-21.0.11+10-jre"
|
||||
|
||||
if not exist "%JRE_EXE%" (
|
||||
echo [JRE] Java 21 runtime not found in portable-dist\jre\
|
||||
echo [JRE] Downloading Temurin 21.0.11 LTS ^(~47 MB^)...
|
||||
echo.
|
||||
|
||||
REM Use PowerShell to download the zip
|
||||
powershell -NoProfile -Command "Invoke-WebRequest -Uri '%JRE_URL%' -OutFile '%JRE_ZIP%'" 2>nul
|
||||
if not exist "%JRE_ZIP%" (
|
||||
echo ERROR: Download failed. Please check your internet connection.
|
||||
echo You can also manually place a Java 21 JRE at:
|
||||
echo %JRE_DIR%
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [JRE] Extracting...
|
||||
|
||||
REM Extract zip then move the inner folder to jre\
|
||||
powershell -NoProfile -Command ^
|
||||
"Expand-Archive -Path '%JRE_ZIP%' -DestinationPath '%TEMP%\temurin21-extract' -Force; " ^
|
||||
"Move-Item -Path '%TEMP%\temurin21-extract\%JRE_FOLDER%' -Destination '%JRE_DIR%' -Force; " ^
|
||||
"Remove-Item '%TEMP%\temurin21-extract' -Recurse -Force -ErrorAction SilentlyContinue; " ^
|
||||
"Remove-Item '%JRE_ZIP%' -Force -ErrorAction SilentlyContinue"
|
||||
|
||||
if not exist "%JRE_EXE%" (
|
||||
echo ERROR: JRE extraction failed. Please manually place a Java 21 JRE at:
|
||||
echo %JRE_DIR%
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [JRE] Java 21 runtime installed successfully.
|
||||
echo.
|
||||
)
|
||||
REM ---------------------------------------------------------------------------
|
||||
|
||||
REM Check if StudioBridge.bat exists
|
||||
if not exist "%PORTABLE%\StudioBridge.bat" (
|
||||
echo ERROR: Could not find portable-dist\StudioBridge.bat
|
||||
echo Please make sure the portable-dist folder exists in:
|
||||
echo %PORTABLE%
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Change to the portable-dist directory
|
||||
|
||||
Reference in New Issue
Block a user