This repository has been archived by the owner on Mar 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.bat
60 lines (47 loc) · 1.49 KB
/
run.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
@echo off
setlocal
set "downloadURL=https://download.oracle.com/java/21/latest/jdk-21_windows-x64_bin.exe"
set "destinationFolder=%TEMP%"
set "installerName=jreinstaller.exe"
echo Furglitch OS Setup
echo.
net session >nul 2>&1
if %errorlevel% neq 0 (
echo Please run as administrator...
pause
exit /b 1
)
cd /d "%~dp0"
java -version >nul 2>&1
if %errorlevel% neq 0 (
echo Java not detected...
echo Downloading the latest JDK21 installer from Oracle...
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('%downloadUrl%', '%destinationFolder%\%installerName%')"
if not exist "%destinationFolder%\%installerName%" (
echo Error: Failed to download the JDK installer.
exit /b 1
)
echo Installing the JDK...
"%destinationFolder%\%installerName%" /s
"C:\Program Files\Java\jdk-21\bin\java.exe" -version >nul 2>&1
set "javaFail=false"
if %errorlevel% neq 0 (
if %errorlevel% neq 9009 (
echo JDK installation failed.
echo Error: %errorLevel%
pause
exit /b 1
)
)
echo Java JDK 21 installation successful...
echo.
echo Running WindowsSetup.jar...
start cmd /c ""C:\Program Files\Java\jdk-21\bin\java.exe" -jar "%~dp0WindowsSetup.jar""
) else (
echo Java detected.
echo.
echo Running WindowsSetup.jar...
start cmd /c "java -jar %~dp0WindowsSetup.jar"
)
timeout 5
endlocal