1@echo off 2rem ------------------------------------------------------------------------- 3rem JBoss Application Client Bootstrap Script for Windows 4rem ------------------------------------------------------------------------- 5 6rem $Id$ 7 8@if not "%ECHO%" == "" echo %ECHO% 9@if "%OS%" == "Windows_NT" setlocal 10rem Set to all parameters by default 11set SERVER_OPTS=%* 12 13if "%OS%" == "Windows_NT" ( 14 set "DIRNAME=%~dp0%" 15 set "PROGNAME=%~nx0%" 16) else ( 17 set DIRNAME=.\ 18 set "PROGNAME=appclient.bat" 19) 20 21setlocal EnableDelayedExpansion 22rem check for the security manager system property 23echo(!SERVER_OPTS! | findstr /r /c:"-Djava.security.manager" > nul 24if not errorlevel == 1 ( 25 echo ERROR: The use of -Djava.security.manager has been removed. Please use the -secmgr command line argument or SECMGR=true environment variable. 26 GOTO :EOF 27) 28setlocal DisableDelayedExpansion 29 30rem Read command-line args, the ~ removes the quotes from the parameter 31:READ-ARGS 32if "%~1" == "" ( 33 goto MAIN 34) else if "%~1" == "-secmgr" ( 35 set SECMGR=true 36) 37shift 38goto READ-ARGS 39 40:MAIN 41 42rem Read an optional configuration file. 43if "x%APPCLIENT_CONF%" == "x" ( 44 set "APPCLIENT_CONF=%DIRNAME%appclient.conf.bat" 45) 46if exist "%APPCLIENT_CONF%" ( 47 echo Calling "%APPCLIENT_CONF%" 48 call "%APPCLIENT_CONF%" %* 49) else ( 50 echo Config file not found "%APPCLIENT_CONF%" 51) 52 53pushd "%DIRNAME%.." 54set "RESOLVED_JBOSS_HOME=%CD%" 55popd 56 57if "x%JBOSS_HOME%" == "x" ( 58 set "JBOSS_HOME=%RESOLVED_JBOSS_HOME%" 59) 60 61pushd "%JBOSS_HOME%" 62set "SANITIZED_JBOSS_HOME=%CD%" 63popd 64 65if /i "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" ( 66 echo. 67 echo WARNING: JBOSS_HOME may be pointing to a different installation - unpredictable results may occur. 68 echo. 69 echo JBOSS_HOME: "%JBOSS_HOME%" 70 echo. 71) 72 73set DIRNAME= 74 75rem Setup JBoss specific properties 76set "JAVA_OPTS=-Dprogram.name=%PROGNAME% %JAVA_OPTS%" 77 78if "x%JAVA_HOME%" == "x" ( 79 set JAVA=java 80 echo JAVA_HOME is not set. Unexpected results may occur. 81 echo Set JAVA_HOME to the directory of your local JDK to avoid this message. 82) else ( 83 set "JAVA=%JAVA_HOME%\bin\java" 84) 85 86rem Add -server to the JVM options, if supported 87"%JAVA%" -server -version 2>&1 | findstr /I hotspot > nul 88if not errorlevel == 1 ( 89 set "JAVA_OPTS=%JAVA_OPTS% -server" 90) 91 92rem If the -Djava.security.manager is found, enable the -secmgr and include a bogus security manager for JBoss Modules to replace 93echo(%JAVA_OPTS% | findstr /r /c:"-Djava.security.manager" > nul && ( 94 echo ERROR: The use of -Djava.security.manager has been removed. Please use the -secmgr command line argument or SECMGR=true environment variable. 95 GOTO :EOF 96) 97 98rem Find run.jar, or we can't continue 99if exist "%JBOSS_HOME%\jboss-modules.jar" ( 100 set "RUNJAR=%JBOSS_HOME%\jboss-modules.jar" 101) else ( 102 echo Could not locate "%JBOSS_HOME%\jboss-modules.jar". 103 echo Please check that you are in the bin directory when running this script. 104 goto END 105) 106 107rem Setup JBoss specific properties 108 109rem Set default module root paths 110if "x%JBOSS_MODULEPATH%" == "x" ( 111 set "JBOSS_MODULEPATH=%JBOSS_HOME%\modules" 112) 113 114rem Set the module options 115set "MODULE_OPTS=" 116if "%SECMGR%" == "true" ( 117 set "MODULE_OPTS=-secmgr" 118) 119 120"%JAVA%" %JAVA_OPTS% ^ 121 "-Dorg.jboss.boot.log.file=%JBOSS_HOME%\appclient\log\appclient.log" ^ 122 "-Dlogging.configuration=file:%JBOSS_HOME%/appclient/configuration/logging.properties" ^ 123 -jar "%JBOSS_HOME%\jboss-modules.jar" ^ 124 %MODULE_OPTS% ^ 125 -mp "%JBOSS_MODULEPATH%" ^ 126 org.jboss.as.appclient ^ 127 "-Djboss.home.dir=%JBOSS_HOME%" ^ 128 "-Djboss.server.base.dir=%JBOSS_HOME%\appclient" ^ 129 %* 130