@echo off
setlocal

set javacmd=java

if "%OS%"=="Windows_NT" goto nt
echo This script only works with NT-based versions of Windows.
goto :eof

:nt
rem
rem Find the application home.
rem
rem %~dp0 is location of current script under NT
set _REALPATH=%~dp0

"%javacmd%" -version
if errorlevel 1 goto nojava

echo =====================================================================
pushd %_REALPATH%

"%javacmd%" -classpath "%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap" com.pmease.quickbuild.bootstrap.SunJVM
if not errorlevel 1 goto sunjvm

"%javacmd%" -Xmx1024m -Xverify:none -classpath "%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/joda-time-2.7.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/wrapper.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/slf4j-api-1.7.2.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/jul-to-slf4j-1.7.2.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/log4j-1.2.15.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/commons-codec-1.10.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/hessian-4.0.38.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/commons-logging-1.0.4.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/servlet-api-3.0.20100224.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/slf4j-log4j12-1.7.2.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/commons-io-1.4.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/commons-lang-2.4.jar" com.pmease.quickbuild.bootstrap.Migrate %1
goto end

:sunjvm
"%javacmd%" -Xmx1024m -Xverify:none -XX:MaxPermSize=256m -classpath "%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/joda-time-2.7.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/wrapper.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/slf4j-api-1.7.2.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/jul-to-slf4j-1.7.2.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/log4j-1.2.15.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/commons-codec-1.10.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/hessian-4.0.38.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/commons-logging-1.0.4.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/servlet-api-3.0.20100224.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/slf4j-log4j12-1.7.2.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/commons-io-1.4.jar";"%_REALPATH%../plugins/com.pmease.quickbuild.bootstrap/lib/commons-lang-2.4.jar" com.pmease.quickbuild.bootstrap.Migrate %1
goto end

:nojava
echo Please make sure the java command exists in the PATH

:end
if not errorlevel 1 goto :eof
pause