Index: gli/trunk/gli.sh
===================================================================
--- gli/trunk/gli.sh	(revision 16483)
+++ gli/trunk/gli.sh	(revision 17484)
@@ -277,51 +277,68 @@
 
 
-## ---- Check Java exists ----
+## ---- Check Java ----
+# Some users may set the above line manually
 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érification de Java: $javapath"
-elif [ "$glilang" = "ru" ]; then
-    echo "ðÒÏ×ÅÒËÁ Java: $javapath"
-else
-    echo "Checking Java: $javapath"
-fi
-if [ ! -x "$javapath" ]; then
-    echo
-    if [ "$glilang" = "es" ]; then
-	echo "No se pudo localizar una versión apropiada de Java. Usted deberá "
-	echo "instalar un Ambiente de Ejecución Java (versión 1.4 o superior) "
-	echo "antes de correr la Interfaz de la $PROGNAME."
-    elif [ "$glilang" = "fr" ]; then
-	echo "Une version adéquate de Java n'a pas pu être localisée."
-	echo "Vous devez installer un Java Runtime Environment (version 1.4 ou"
-	echo "supérieur) avant de démarrer $PROGNAME."
-    elif [ "$glilang" = "ru" ]; then
-	echo "îÅ ÕÄÁÌÏÓØ ÏÐÒÅÄÅÌÉÔØ ÍÅÓÔÏÎÁÈÏÖÄÅÎÉÅ ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÅÊ ×ÅÒÓÉÉ Java."
-	echo "÷Ù ÄÏÌÖÎÙ ÕÓÔÁÎÏ×ÉÔØ Java Runtime Environment (×ÅÒÓÉÀ 1.4 ÉÌÉ ×ÙÛÅ)"
-	echo "ÐÅÒÅÄ ××ÏÄÏÍ ÂÉÂÌÉÏÔÅÞÎÏÇÏ $PROGNAME."
-    else
-	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 "$PROGNAME."
-    fi
-    exit 1
-fi
+if [ "$javapath" == "" ]; then
+
+	HINT=`cd ..;pwd`
+	javapath=`../bin/search4j -e -p $HINT -m 1.4.0_00`
+
+    if [ "$?" != "0" ]; then
+
+		../bin/search4j -e -p $HINT
+
+		if [ "$?" != "0" ]; then
+
+		    if [ "$glilang" = "es" ]; then
+				echo "La versión del Ambiente de Ejecución Java (JRE por sus siglas en "
+				echo "inglés) que usted tiene instalada es demasiado vieja para ejecutar "
+				echo "la Interfaz de la $PROGNAME. Por favor instale "
+				echo "una nueva versión del Ambiente de Ejecución Java (versión 1.4 o "
+				echo "posterior) y ejecute nuevamente este guión."
+		    elif [ "$glilang" = "fr" ]; then
+				echo "La version de Java Runtime Environment que vous avez installée est"
+				echo "trop vielle pour faire fonctionner $PROGNAME."
+				echo "Veuillez installer une nouvelle version du JRE (version 1.4 ou plus"
+				echo "récente) et redémarrez le script."
+		    elif [ "$glilang" = "ru" ]; then
+				echo "÷ÅÒÓÉÑ Java Runtime Environment, ËÏÔÏÒÕÀ ÷Ù ÕÓÔÁÎÏ×ÉÌÉ, ÏÞÅÎØ ÓÔÁÒÁ,"
+				echo "ÞÔÏÂÙ ÕÐÒÁ×ÌÑÔØ ÂÉÂÌÉÏÔÅÞÎÙÍ $PROGNAME. ðÏÖÁÌÕÊÓÔÁ, "
+				echo "ÕÓÔÁÎÏ×ÉÔÅ ÎÏ×ÕÀ ×ÅÒÓÉÀ JRE (×ÅÒÓÉÀ 1.4 ÉÌÉ ÂÏÌÅÅ ÎÏ×ÕÀ) É"
+				echo "ÐÅÒÅÕÓÔÁÎÏ×ÉÔÅ ÜÔÏÔ ÓËÒÉÐÔ"
+		    else
+				echo "The version of the Java Runtime Environment you have installed is too"
+				echo "old to run the $PROGNAME. Please install a new"
+				echo "version of the JRE (version 1.4 or newer) and rerun this script."
+		    fi
+		    exit 1
+
+		else
+
+		    echo
+		    if [ "$glilang" = "es" ]; then
+				echo "No se pudo localizar una versión apropiada de Java. Usted deberá "
+				echo "instalar un Ambiente de Ejecución Java (versión 1.4 o superior) "
+				echo "antes de correr la Interfaz de la $PROGNAME."
+		    elif [ "$glilang" = "fr" ]; then
+				echo "Une version adéquate de Java n'a pas pu être localisée."
+				echo "Vous devez installer un Java Runtime Environment (version 1.4 ou"
+				echo "supérieur) avant de démarrer $PROGNAME."
+		    elif [ "$glilang" = "ru" ]; then
+				echo "îÅ ÕÄÁÌÏÓØ ÏÐÒÅÄÅÌÉÔØ ÍÅÓÔÏÎÁÈÏÖÄÅÎÉÅ ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÅÊ ×ÅÒÓÉÉ Java."
+				echo "÷Ù ÄÏÌÖÎÙ ÕÓÔÁÎÏ×ÉÔØ Java Runtime Environment (×ÅÒÓÉÀ 1.4 ÉÌÉ ×ÙÛÅ)"
+				echo "ÐÅÒÅÄ ××ÏÄÏÍ ÂÉÂÌÉÏÔÅÞÎÏÇÏ $PROGNAME."
+		    else
+				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 "$PROGNAME."
+		    fi
+		fi
+
+	fi
+
+fi
+
+echo "Java: $javapath"
 
 
@@ -330,26 +347,4 @@
 if [ $? -ne 2 ] ; then
     echo
-    if [ "$glilang" = "es" ]; then
-	echo "La versión del Ambiente de Ejecución Java (JRE por sus siglas en "
-	echo "inglés) que usted tiene instalada es demasiado vieja para ejecutar "
-	echo "la Interfaz de la $PROGNAME. Por favor instale "
-	echo "una nueva versión del Ambiente de Ejecución Java (versión 1.4 o "
-	echo "posterior) y ejecute nuevamente este guión."
-    elif [ "$glilang" = "fr" ]; then
-	echo "La version de Java Runtime Environment que vous avez installée est"
-	echo "trop vielle pour faire fonctionner $PROGNAME."
-	echo "Veuillez installer une nouvelle version du JRE (version 1.4 ou plus"
-	echo "récente) et redémarrez le script."
-    elif [ "$glilang" = "ru" ]; then
-	echo "÷ÅÒÓÉÑ Java Runtime Environment, ËÏÔÏÒÕÀ ÷Ù ÕÓÔÁÎÏ×ÉÌÉ, ÏÞÅÎØ ÓÔÁÒÁ,"
-	echo "ÞÔÏÂÙ ÕÐÒÁ×ÌÑÔØ ÂÉÂÌÉÏÔÅÞÎÙÍ $PROGNAME. ðÏÖÁÌÕÊÓÔÁ, "
-	echo "ÕÓÔÁÎÏ×ÉÔÅ ÎÏ×ÕÀ ×ÅÒÓÉÀ JRE (×ÅÒÓÉÀ 1.4 ÉÌÉ ÂÏÌÅÅ ÎÏ×ÕÀ) É"
-	echo "ÐÅÒÅÕÓÔÁÎÏ×ÉÔÅ ÜÔÏÔ ÓËÒÉÐÔ"
-    else
-	echo "The version of the Java Runtime Environment you have installed is too"
-	echo "old to run the $PROGNAME. Please install a new"
-	echo "version of the JRE (version 1.4 or newer) and rerun this script."
-    fi
-    exit 1
 fi
 
