2 REM Windows Hatch Execution Script
3 REM @echo off required for STDIO to work with the browser.
5 REM NOTE: Do not EVER set ERRORLEVEL for any reason; it's a passthrough variable that takes on the current value
6 REM of the errorlevel return status but if you assign to it that magic passthrough is broken and it's just set to that value.
7 REM This is necessary to do sensible comparisons against it. (such as EQU) The 'if errorlevel' construct is completely bananas.
8 REM Also: automatic path testing only looks for 'java' - if you don't have the JDK in your path you'll need to fix that yourself.
10 REM Assume java executables are in our path
15 REM Optionally override the java path
16 REM SET JAVA_HOME="C:\Program Files\Java\jdk1.8.0_111"
17 REM SET JAVA=%JAVA_HOME%\bin\java
18 REM SET JAVAC=%JAVA_HOME%\bin\javac
19 REM SET JAR=%JAVA_HOME%\bin\jar
24 IF %ERRORLEVEL% EQU 0 GOTO Huzzah
26 REM Are you still there?
27 SET JAVA=%PROGRAMDATA%\Oracle\Java\javapath\java
30 IF %ERRORLEVEL% EQU 0 GOTO Huzzah
38 REM %~1 means to strip %1 of any surrounding quotes.
39 REM This is necessary if you're going to use a construction like "%1" == "etc" because a quoted %1 will
40 REM cause silent failures when the batch file is run and dies because the IF command has a syntax error.
41 REM Specifically, "Files was unexpected at this time."
43 IF "%~1" == "compile" (
45 %JAVAC% -cp "lib\*" -Xdiags:verbose^
46 -d lib src\org\evergreen_ils\hatch\*.java
48 %JAR% cf lib\hatch.jar -C lib org
56 -Djava.util.logging.config.file=logging.properties^
57 org.evergreen_ils.hatch.TestHatch | %JAVA% -cp "lib\*"^
58 -Djava.util.logging.config.file=logging.properties^
59 org.evergreen_ils.hatch.Hatch | %JAVA% -cp "lib\*"^
60 -Djava.util.logging.config.file=logging.properties^
61 org.evergreen_ils.hatch.TestHatch receive
63 ) ELSE ( REM No options means run Hatch
66 -Djava.util.logging.config.file=logging.properties^
67 org.evergreen_ils.hatch.Hatch