-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartSimulation.bat
42 lines (33 loc) · 1.08 KB
/
startSimulation.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
@echo off
SET "program_name=Satogaeri"
SET "main_class_java_path=main.Main"
SET "main_class_file_path=src\main\Main.java"
SET "output_folder=build"
SET "script_directory=%~dp0"
WHERE /Q javac
IF ERRORLEVEL 1 (
ECHO error: No Java installation was found! Make sure Java 8 or newer is installed correctly >&2
ECHO error: and visible inside your PATH variable. >&2
PAUSE
EXIT 2
)
IF NOT EXIST "%main_class_file_path%" (
ECHO error: You are not in the correct root directory. Please execute this script from >&2
ECHO error: %script_directory% >&2
PAUSE
EXIT 2
)
ECHO [%program_name%]: Compiling Java sources ...
javac -d "%output_folder%" -classpath "src" "%main_class_file_path%"
IF ERRORLEVEL 0 IF NOT ERRORLEVEL 1 (
ECHO [%program_name%]: Compiled bytecode was moved to '%output_folder%': folder.
ECHO.
ECHO [%program_name%]: Executing %program_name%
java -classpath "%output_folder%" "%main_class_java_path%"
PAUSE
EXIT %ERRORLEVEL%
) ELSE (
ECHO [%program_name%]: Failed to compile the Java sources! Exiting ...
PAUSE
EXIT 1
)