@echo off echo Building and Running Chronic Disease App... REM Kill any running Java processes echo Checking for running Java processes... tasklist | findstr java >nul 2>nul if %errorlevel% equ 0 ( echo Found running Java processes. Attempting to terminate... taskkill /F /IM java.exe >nul 2>nul if %errorlevel% equ 0 ( echo Successfully terminated Java processes. ) else ( echo Warning: Failed to terminate some Java processes. Please check manually. ) ) else ( echo No running Java processes found. ) REM Switch to script directory to ensure Maven runs in project folder pushd "%~dp0" REM Check if Maven is installed where mvn >nul 2>nul if %errorlevel% neq 0 ( echo Error: Maven is not installed or not in PATH pause exit /b 1 ) echo Cleaning log directory... if exist logs ( rmdir /s /q logs echo Log directory cleared. ) else ( echo No log directory to clear. ) echo Cleaning project... call mvn clean echo Building project... echo Building project (enable compiler parameters)... call mvn package -Dmaven.compiler.parameters=true if %errorlevel% neq 0 ( echo Error: Build failed pause exit /b 1 ) echo Running application... echo Running application with JVM add-opens for java.lang.invoke... java --add-opens=java.base/java.lang.invoke=ALL-UNNAMED -jar target/ChronicDiseaseApp-1.0-SNAPSHOT.jar REM Return to original directory popd