Index: trunk/in-the-cloud/findjava.bat
===================================================================
--- trunk/in-the-cloud/findjava.bat	(revision 1071)
+++ trunk/in-the-cloud/findjava.bat	(revision 1071)
@@ -0,0 +1,73 @@
+@echo off
+
+setlocal enabledelayedexpansion
+
+:: Environment Variables passed in: EXP_LANG
+:: As a result of executing this script, the JAVA_EXECUTABLE and EXP_JAVA_HOME
+:: environment variables will be set, but only if Perl was found.
+
+:findJava
+
+:: We should already be in the folder containing a compiled-up search4j.exe
+:: if this Expeditee is part of an installation.
+:: If search4j.exe is not there, then it means this is an SVN checkout. 
+:: In such a case, it's up to the user checking things out to ensure JAVA_HOME
+:: is set and moreover points to the correct version of the Java.
+
+set DISPLAY_MIN_VERSION=1.8
+set MIN_VERSION=1.8.0_00
+set SEARCH4J_EXECUTABLE=search4j.exe
+::set HINT=%EXPEDITEE_HOME%\packages\jre
+set HINT=packages\jre
+if exist %SEARCH4J_EXECUTABLE% goto setJexec
+set SEARCH4J_EXECUTABLE=%EXPEDITEE_CLOUD_HOME%\search4j.exe
+if not exist "%SEARCH4J_EXECUTABLE%" goto tryJava
+
+:: JAVA_EXECUTABLE is the value returned by running search4j -e -m MIN_VERSION -p HINT
+:setJexec
+	for /f "tokens=* usebackq" %%G in (`"%SEARCH4J_EXECUTABLE%" -e -m '%MIN_VERSION%' -p %HINT%`) do set JAVA_EXECUTABLE=%%G
+	
+    if "%JAVA_EXECUTABLE%" == "" goto noJava
+    echo Java:
+    echo %JAVA_EXECUTABLE%
+    echo.
+
+    :: we know that works, so we can set the local javahome (for Expeditee) as well
+    for /f "tokens=* usebackq" %%G in (`"%SEARCH4J_EXECUTABLE%" -m '%MIN_VERSION%' -p %HINT%`) do set EXP_JAVA_HOME=%%G
+
+:: found java, JAVA_EXECUTABLE and EXP_JAVA_HOME env vars set, can exit this script
+    goto exit
+
+:tryJava
+if "%JAVA_HOME%" == "" goto noJava
+if not exist "%JAVA_HOME%\bin\java.exe" goto noJava
+	if "%GLILANG%" == "en" (
+		echo.
+		echo ***************************************************************************
+    		echo WARNING: 
+		echo Java Runtime not bundled with this %PROGNAME% installation.
+		echo Using JAVA_HOME: !JAVA_HOME!
+		echo ^(NOTE: this needs to be %DISPLAY_MIN_VERSION% or higher.^)
+		echo ***************************************************************************
+		echo.
+	)
+	:: Try to use this version
+	set JAVA_EXECUTABLE=%JAVA_HOME%\bin\java
+	set EXP_JAVA_HOME=%JAVA_HOME%
+	goto exit
+
+:noJava
+    echo.
+    if "%EXP_LANG%" == "en" (
+		echo Failed to locate an appropriate version of Java. You must install a
+    		echo Java Runtime Environment ^(version %DISPLAY_MIN_VERSION% or greater^) before running the
+    		echo %PROGNAME%.
+	)
+    goto exit
+
+:exit
+set SEARCH4J_EXECUTABLE=
+set MIN_VERSION=
+set DISPLAY_MIN_VERSION=
+
+endlocal & set JAVA_EXECUTABLE=%JAVA_EXECUTABLE%& set EXP_JAVA_HOME=%EXP_JAVA_HOME%
Index: trunk/in-the-cloud/findjava.sh
===================================================================
--- trunk/in-the-cloud/findjava.sh	(revision 1071)
+++ trunk/in-the-cloud/findjava.sh	(revision 1071)
@@ -0,0 +1,126 @@
+# Need to be in the folder containing a compiled-up search4j
+# If a search4j executable is not there, then it means this is an SVN checkout. 
+# In such a case, it's up to the user checking things out to ensure JAVA_HOME
+# is set and that it moreover points to the correct version of the Java.
+
+# Function to check if any JAVA_HOME is set and if so, try using that
+function try_java {
+    MIN_DISPLAY_VERSION=${1};
+
+    if [ "x$JAVA_HOME" = "x" -o ! -f "$JAVA_HOME/bin/java" ]; then
+	no_java "$MIN_DISPLAY_VERSION"
+	return $?
+    else
+	# There is a JAVA_HOME already set, we're going to try using that
+	javapath="$JAVA_HOME/bin/java"
+	javahome="$JAVA_HOME"
+	# Print a warning that we're going to use whatever JAVA_HOME is set (fingers crossed)
+	if [ "x$exp_lang" = "x" -o "$exp_lang" = "en" ]; then
+	    echo
+	    echo "***************************************************************************"
+	    echo "WARNING: "
+	    echo "Java Runtime not bundled with this $PROGNAME installation."
+	    echo "Using JAVA_HOME: $JAVA_HOME"
+	    echo "(NOTE: this needs to be $MIN_DISPLAY_VERSION or higher.)"
+	    echo "***************************************************************************"
+	    echo
+	fi
+	echo "Java:"
+	echo $javapath
+	echo
+	return 0
+    fi
+}
+
+function no_java {
+    MIN_DISPLAY_VERSION=${1};
+
+    echo
+    if [ "x$exp_lang" = "x" -o "$exp_lang" = "en" ]; then
+	echo "Failed to locate an appropriate version of Java. You must install a"
+	echo "Java Runtime Environment (version $MIN_DISPLAY_VERSION or greater) before running the"
+	echo "$PROGNAME."
+	echo "If you have Java installed on your machine please set the environment variable JAVA_HOME."
+    fi
+    return 1
+}
+
+function set_java_exec {	
+    SEARCH4J_EXECUTABLE=${1};
+    MINIMUM_JAVA_VERSION=${2};
+    MIN_DISPLAY_VERSION=${3};
+
+    # Give search4j a hint to find Java depending on the platform
+    if [ "$EXPEDITEE_OS" = "linux" ]; then
+	HINT=`cd "$EXPEDITEE_HOME";pwd`/packages/jre
+    elif [ "$EXPEDITEE_OS" = "darwin" ]; then
+	HINT=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
+        #/System/Library/Frameworks/JavaVM.framework/Home
+    fi	
+    
+    javapath="`"$SEARCH4J_EXECUTABLE" -e -p "$HINT" -m $MINIMUM_JAVA_VERSION`"
+    javahome="`"$SEARCH4J_EXECUTABLE" -p "$HINT" -m $MINIMUM_JAVA_VERSION`"
+
+    if [ "$?" != "0" ]; then
+	
+        OLDVER="`"$SEARCH4J_EXECUTABLE" -v -p "$HINT"`"
+	
+        if [ "$?" = "0" ]; then
+	    
+            if [ "x$exp_lang" = "x" -o "$exp_lang" = "en" ]; then
+                echo "The version of the Java Runtime Environment you have installed ($OLDVER)"
+                echo "is too old to run the $PROGNAME. Please install a new"
+                echo "version of the JRE (version $MIN_DISPLAY_VERSION or newer) and rerun this script."
+            fi
+            return 1
+	    
+        else
+	    no_java "$MIN_DISPLAY_VERSION"
+	    return $?
+        fi
+	
+    fi
+    echo "Java:"
+    echo $javapath
+    echo
+    return 0
+}
+
+
+## ---- Check Java ----
+# Some users may set this line manually
+javahome=
+exp_lang=$1
+PROGNAME=$2
+MINIMUM_JAVA_VERSION=1.8.0_00
+MIN_DISPLAY_VERSION=1.8
+if [ "x$javahome" != "x" ]; then
+    JAVA_HOME=$javahome;
+    try_java "$MIN_DISPLAY_VERSION"
+    retval=$?
+    return $retval
+fi
+
+# sus out search4j
+# first look for compiled search4j executable inside the current folder
+if [ -x "search4j" ]; then
+    SEARCH4J_EXECUTABLE="./search4j"
+elif [ -x "$EXPEDITEE_HOME/bin/search4j" ]; then
+    SEARCH4J_EXECUTABLE="$EXPEDITEE_HOME/bin/search4j"
+else
+    echo "Couldn't determine the location of the search4j executable"
+    echo "If you are running Expeditee"
+    echo "   * check EXPEDITEE_HOME is set"
+    echo "   * check bin/search4j exists"
+    echo "   * check bin/search4j is executable"
+fi
+
+# Now run set_java_exec with search4j if we found one, else try javahome
+if [ "x$SEARCH4J_EXECUTABLE" != "x" ]; then
+    set_java_exec "$SEARCH4J_EXECUTABLE" "$MINIMUM_JAVA_VERSION" "$MIN_DISPLAY_VERSION"
+    retval=$?
+else
+    try_java "$MIN_DISPLAY_VERSION"
+    retval=$?
+fi
+return $retval
Index: trunk/in-the-cloud/run-in-the-cloud.bat
===================================================================
--- trunk/in-the-cloud/run-in-the-cloud.bat	(revision 1071)
+++ trunk/in-the-cloud/run-in-the-cloud.bat	(revision 1071)
@@ -0,0 +1,39 @@
+@echo off
+SETLOCAL enabledelayedexpansion
+
+if "%EXP_LANG%" == "" set EXP_LANG=en
+set PROGNAME=Expeditee
+set EXPEDITEE_OS=windows
+
+:: go into the folder where this script lives and run expeditee from there
+pushd "%CD%"
+REM CD /D "%~dp0"
+set EXPEDITEE_CLOUD_HOME=%CD%
+
+::  -------- Run Expeditee --------
+
+:: JRE_HOME or JAVA_HOME must be set correctly to run Expeditee
+
+:: ---- Check Java ----
+:chkjava
+:: call the findjava script so that we have the variables JAVA_EXECUTABLE and EXP_JAVA_HOME that it sets
+set exit_status=0
+:: Need to find Java. If found, JAVA_EXECUTABLE will be set
+:: call findjava.bat %EXP_LANG% %PROGNAME%
+call "%EXPEDITEE_CLOUD_HOME%\findjava.bat"
+if "%JAVA_EXECUTABLE%" == "" echo **** No Java executable found& goto exit
+set PATH=%EXP_JAVA_HOME%\bin;%PATH%
+
+
+set java_props=
+if not "%EXPEDITEE_FILESYSTEM%" == "" (
+    "%JAVA_EXECUTABLE%" %java_props% "-Dexpeditee.home=%EXPEDITEE_FILESYSTEM%" -jar ..\releases\Expeditee.jar %*
+    goto exit
+)
+
+"%JAVA_EXECUTABLE%" %java_props% -jar ..\releases\Expeditee.jar %*
+
+
+:exit
+popd
+ENDLOCAL
