Index: trunk/gsdl3/gs3-server.bat
===================================================================
--- trunk/gsdl3/gs3-server.bat	(revision 13235)
+++ trunk/gsdl3/gs3-server.bat	(revision 13235)
@@ -0,0 +1,126 @@
+@echo off
+set SERVERLANG=en
+
+:: This script must be run from within the directory in which it lives
+if exist gs3-server.bat goto start
+    if "%SERVERLANG%" == "en" echo This script must be run from the directory in wh
+ich it resides.
+    if "%SERVERLANG%" == "es" echo Este gui<A2>n deber<A0> ejecutarse desde el dire
+ctorio en el que reside.
+    if "%SERVERLANG%" == "fr" echo Ce script doit <88>tre ex<82>cut<82> <85> partir
+ du r<82>pertoire dans lequel il se trouve.
+    if "%SERVERLANG%" == "ru" echo <9D><E2><AE><E2> <E1><AA><E0><A8><AF><E2> <A4>
+<AE><AB><A6><A5><AD> <A1><EB><E2><EC> <A2><A7><EF><E2> <A8><A7> <A4><A8><E0><A5>
+<AA><E2><AE><E0><A8><A8>, <A2> <AA><AE><E2><AE><E0><AE><A9> <AE><AD> <E0><A0>
+<E1><AF><AE><AB><AE><A6><A5><AD>
+    goto exit
+
+echo.
+echo "Greenstone 3 Server"
+echo "Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato"
+echo "This software comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt"
+echo "This is free software, and you are welcome to redistribute it"
+echo.
+
+echo.
+::  ---- Determine GSDLHOME ----
+set GSDL3PATH=
+
+:: Some users may set the above line manually
+if not "%GSDL3PATH%" == "" goto prepGSDL
+
+    :: The default location is the current directory
+    set GSDL3PATH=.
+
+    :: If it is set, use the GSDLHOME environment variable
+    if "%GSDL3HOME%" == "" goto prepGSDL
+        set GSDL3PATH=%GSDL3SRCHOME%
+
+:prepGSDL
+:: Setup Greenstone, unless it has already been done
+if not "%GSDL3SRCHOME%" == "" goto doneGSDL
+    call "%GSDL3PATH%\gs3-setup.bat" SetEnv > nul
+
+:doneGSDL
+:: GSDL3PATH is no longer needed, since GSDL3SRCHOME should now be set
+set GSDL3PATH=
+
+findJava
+:: ---- Check Java exists ----
+set JAVAPATH=
+
+:: Some users may set the above line manually
+if not "%JAVAPATH%" == "" goto testJava
+
+    :: If it is set, use the JAVA_HOME environment variable
+    if not "%JAVA_HOME%" == "" goto javahome
+
+    :: Check if Java is on the search path
+    echo %PATH%| winutil\which.exe java.exe | winutil\setvar.exe JAVAPATH > setjava.bat
+    call setjava.bat
+    del setjava.bat
+    if not "%JAVAPATH%" == "" goto testJava
+
+    :: Still haven't found anything, so try looking in the registry (gulp!)
+    type nul > jdk.reg
+    regedit /E jdk.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit"
+    type jdk.reg > jdk.txt
+    del jdk.reg
+    type nul > jre.reg
+    regedit /E jre.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment"
+    type jre.reg > jre.txt
+    del jre.reg
+
+    winutil\findjava.exe jdk.txt jre.txt | winutil\setvar.exe JAVAPATH > setjava.bat
+    del jdk.txt
+    del jre.txt
+    call setjava.bat
+    del setjava.bat
+
+   :: If nothing was found in the registry, we're stuck
+    if "%JAVAPATH%" == "" goto noJava
+
+    set JAVAPATH=%JAVAPATH%\bin
+    goto testJava
+
+:javahome
+    set JAVAPATH=%JAVA_HOME%\bin
+
+:testJava
+:: Check that a Java executable has been found
+if "%GLILANG%" == "en" echo Checking Java: %JAVAPATH%
+if "%GLILANG%" == "es" echo Revisando Java: %JAVAPATH%
+if "%GLILANG%" == "fr" echo V<82>rification de Java: %JAVAPATH%
+if "%GLILANG%" == "ru" echo <8F><E0><AE><A2><A5><E0><AA><A0> Java: %JAVAPATH%
+if exist "%JAVAPATH%\java.exe" goto checkGLI
+
+:noJava
+echo.
+echo Failed to locate an appropriate version of Java. You must install a
+echo Java Runtime Environment (version 1.4 or greater) before running the
+echo Greenstone Server.
+
+goto exit
+
+:checkServer
+---- Check that the server program has been compiled ----
+if exist "server.jar" goto runServer
+
+echo "You need to compile the code before running the server"
+goto exit
+
+:runServer
+
+echo Running the Greenstone Server
+
+:: -Xms32M          To set minimum memory
+:: -Xmx32M          To set maximum memory
+:: -verbose:gc      To set garbage collection messages
+:: -Xincgc          For incremental garbage collection
+:: -Xprof           Function call profiling
+:: -Xloggc:<file>   Write garbage collection log
+
+"%JAVAPATH%\java" -cp %CLASSPATH% org.greenstone.server.Server "%GSDL3SRCHOME%"
+
+
+ 
Index: trunk/gsdl3/gs3-server.sh
===================================================================
--- trunk/gsdl3/gs3-server.sh	(revision 13235)
+++ trunk/gsdl3/gs3-server.sh	(revision 13235)
@@ -0,0 +1,107 @@
+#!/bin/sh
+serverlang=en
+
+echo
+echo "Greenstone 3 Server"
+echo "Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato"
+echo "This software comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt"
+echo "This is free software, and you are welcome to redistribute it"
+echo
+
+##  -------- Run the Greenstone 3 Server --------
+
+# This script must be run from within the directory in which it lives
+thisdir=`pwd`
+if [ ! -f "${thisdir}/gs3-server.sh" ]; then
+    if [ "$serverlang" == "es" ]; then
+        echo "Este guión deberá ejecutarse desde el directorio en el que reside."
+    elif [ "$serverlang" == "fr" ]; then
+	echo "Ce script doit être exécuté à partir du répertoire dans lequel il se trouve."
+    elif [ "$serverlang" == "ru" ]; then
+	echo "üÔÏÔ ÓËÒÉÐÔ ÄÏÌÖÅÎ ÂÙÔØ ×ÚÑÔ ÉÚ ÄÉÒÅËÔÏÒÉÉ, × ËÏÔÏÒÏÊ ÏÎ ÒÁÓÐÏÌÏÖÅÎ"
+    else
+	echo "This script must be run from the directory in which it resides."
+    fi
+    exit 1
+fi
+
+
+##  ---- Determine GSDL3SRCHOME ----
+gsdl3path=
+
+# Some users may set the above line manually
+if [ "x$gsdl3path" == "x" ]; then
+    # Check the environment variable first
+    if [ "x$GSDL3SRCHOME" != "x" ]; then
+	gsdl3path=$GSDL3SRCHOME
+    else
+	gsdl3path=`pwd`
+    fi
+fi
+
+# Setup Greenstone3, unless it has already been done
+if [ "x$GSDL3SRCHOME" == "x" ]; then
+    pushd $gsdl3path > /dev/null
+    source gs3-setup.sh
+    popd > /dev/null
+fi
+
+## ---- Check Java exists ----
+javapath=
+
+# Some users may set the above line manually
+if [ "x$javapath" = "x" ]; then
+
+    # If it is set, use the JAVA_HOME environment variable
+    if [ "x$JAVA_HOME" != "x" ]; then
+        javapath="$JAVA_HOME/bin/java"
+
+    # Check if Java is on the search path
+    else
+        javapath=`which java 2> /dev/null`
+    fi
+fi
+
+# Check that a Java executable has been found
+if [ "$glilang" = "es" ]; then
+    echo "Revisando Java: $javapath"
+elif [ "$glilang" = "fr" ]; then
+    echo "V<E9>rification de Java: $javapath"
+elif [ "$glilang" = "ru" ]; then
+    echo "<F0><D2><CF><D7><C5><D2><CB><C1> Java: $javapath"
+else
+    echo "Checking Java: $javapath"
+fi
+if [ ! -x "$javapath" ]; then
+    echo
+    echo "Failed to locate an appropriate version of Java. You must installa"
+    echo "Java Runtime Environment (version 1.4 or greater) before running the"
+    echo "Greenstone Server."
+exit 1
+fi
+
+## -- Check the version of Java is new enough (1.4.0 or higher) to run the GLI --
+#`$javapath -classpath . CheckJavaVersion > /dev/null`
+#if [ $? -ne 2 ] ; then
+#   echo "The version of the Java Runtime Environment you have installed is too"
+#   echo "old to run the Greenstone Librarian Interface. Please install a new"
+#   echo "version of the JRE (version 1.4 or newer) and rerun this script."
+#exit 1
+#fi
+
+## ---- Check that the server has been compiled ----
+if [ ! -f server.jar ]; then
+  echo "You need to compile the server before running this script"
+  exit 1
+fi
+
+
+# Other arguments you can provide to java 
+# -Xms<number>M    To set minimum memory (by default 32MB)
+# -Xmx<number>M    To set maximum memory (by default the nearest 2^n to the total remaining physical memory)
+# -verbose:gc      To set garbage collection messages
+# -Xincgc          For incremental garbage collection (significantly slows performance)
+# -Xprof           Function call profiling
+# -Xloggc:<file>   Write garbage collection log
+
+java -cp $CLASSPATH org.greenstone.server.Server $GSDL3SRCHOME 
