11@ rem ***************************************************************************
2- @ rem Copyright (c) 2017 James Mover Zhou
2+ @ rem Copyright (c) 2023 James Mover Zhou
33@ rem
44@ rem Licensed under the Apache License, Version 2.0 (the "License");
55@ rem you may not use this file except in compliance with the License.
1414@ rem limitations under the License.
1515@ rem ***************************************************************************
1616@ echo off
17+
18+ @ REM Check if JAVA_HOME is set and valid
19+ if " %JAVA_HOME% " == " " (
20+ echo Error: JAVA_HOME not found in your environment. >& 2
21+ echo Please set the JAVA_HOME variable in your environment to match the location of your Java installation. >& 2
22+ exit /B 1
23+ )
24+
25+ if not exist " %JAVA_HOME% \bin\java.exe" (
26+ echo Error: JAVA_HOME is set to an invalid directory. >& 2
27+ echo JAVA_HOME = " %JAVA_HOME% " >& 2
28+ echo Please set the JAVA_HOME variable in your environment to match the location of your Java installation. >& 2
29+ exit /B 1
30+ )
31+
32+ set " JAVA_CMD = %JAVA_HOME% \bin\java.exe"
33+
34+ @ REM Consolidate classpath entries, initialize ROOT and VERSION
1735set " ROOT = %~dp0 ..\"
18- set " VERSION = 1.2.1"
19- set " classpath = %ROOT% target\classes:%ROOT% lib\*:%ROOT% WEB-INF\lib\*:%ROOT% WEB-INF\classes" :%classpath%
20- @ java -cp " %ROOT% target\classes;%ROOT% lib\tinystruct-%VERSION% -jar-with-dependencies.jar;%ROOT% lib\*;%ROOT% WEB-INF\lib\*;%ROOT% WEB-INF\classes;%USERPROFILE% \.m2\repository\org\tinystruct\tinystruct\%VERSION% \tinystruct-%VERSION% -jar-with-dependencies.jar" org.tinystruct.system.Dispatcher %*
36+ set " VERSION = 1.2.2"
37+ set " classpath = %ROOT% target\classes;%ROOT% lib\tinystruct-%VERSION% -jar-with-dependencies.jar;%ROOT% lib\*;%ROOT% WEB-INF\lib\*;%ROOT% WEB-INF\classes;%USERPROFILE% \.m2\repository\org\tinystruct\tinystruct\%VERSION% \tinystruct-%VERSION% -jar-with-dependencies.jar"
38+
39+ @ REM Run Java application
40+ %JAVA_CMD% -cp " %classpath% " org.tinystruct.system.Dispatcher %*
0 commit comments