@echo off
REM This is a helper file to start the PeaFactory or a single PEA in Windows
REM In most cases, the Jar files can be started by double-clicking. 
REM In some cases, archive programs have overwritten this function, and executable jar files 
REM can not be started. Then the program can be started with a double-click on this script.
REM This script also looks for a suitable Java version and shows an error message if none is found.
REM set variables:
set PEA_FILE_NAME=calendar
set PEA_VERSION=1.2
PATH %PATH%;%JAVA_HOME%\bin\
REM search for java version - this should work until java 1.9
for /f tokens^=2-5^ delims^=.-_^" %%j in ('java -fullversion 2^>^&1') do set "jver=%%j%%k%%l%%m"
REM echo %jver%
REM check for java 1.8 (18000)
if %jver% LSS 18000 (
echo %PEA_FILE_NAME% %PEA_VERSION%
echo Cant find suitable java version. 
echo You need at least Java Runtime Environment 1.8 to run this program
pause
) else (
REM Start PEA in minimized console:
echo starting %PEA_FILE_NAME% %PEA_VERSION%
start /min java -jar %PEA_FILE_NAME%.jar 
)

