source: gli/trunk/findjava.bat@ 19922

Last change on this file since 19922 was 19353, checked in by ak19, 15 years ago

Updated client-gli.bat and findjava.bat. Now client-gli uses the same logic to find Java as gli.bat. Previously client-gli would resort to looking in the registry since there was no search4j in GLI. Now there is, and only svn versions of gli-only checkouts won't have a search4j (compiled up). findjava.bat now looks for search4j to get Java, otherwise it looks for JAVA_HOME to be set--to any Java--and uses that after printing a warning message to the user. Finally, if there is neither a search4j nor any JAVA_HOME set, then it exits.

File size: 3.3 KB
Line 
1@echo off
2
3:: Environment Variables passed in: _VERSION, GLILANG and
4:: possibly also GSDLHOME and/or GSDL3SRCHOME.
5:: As a result of executing this script, the JAVA_EXECUTABLE variable
6:: will be set, but only if Perl was found.
7
8:findJava
9
10:: We will already be in the correct folder (GLI folder), which would
11:: contain a compiled up search4j.exe if this GLI is part of an installation.
12:: If search4j.exe is not there, then it means this is an SVN checkout.
13:: In such a case, it's up to the user checking things out to ensure JAVA_HOME
14:: is set and moreover points to the correct version of the Java.
15
16set DISPLAY_MIN_VERSION=1.4
17set MIN_VERSION=1.4.0_00
18set SEARCH4J_EXECUTABLE=search4j.exe
19if exist %SEARCH4J_EXECUTABLE% goto setJexec
20if "%_VERSION%" == "" goto tryJava
21 :: else we look for a compiled version of search4j in a GS installation
22 if "%_VERSION%" == "2" (
23 set SEARCH4J_EXECUTABLE=%GSDLHOME%\bin\windows\search4j.exe
24 set HINT=%GSDLHOME%\packages\jre
25 )
26 if "%_VERSION%" == "3" (
27 set SEARCH4J_EXECUTABLE=%GSDL3SRCHOME%\bin\search4j.exe
28 set HINT=%GSDL3SRCHOME%\packages\jre
29 )
30 if not exist "%SEARCH4J_EXECUTABLE%" goto tryJava
31
32:setJexec
33 "%SEARCH4J_EXECUTABLE%" -e -m "%MIN_VERSION%" -p "%HINT%" | winutil\setvar.exe JAVA_EXECUTABLE > %TMP%\set_java_executable.bat
34 call "%TMP%\set_java_executable.bat"
35 del "%TMP%\set_java_executable.bat"
36
37 if "%JAVA_EXECUTABLE%" == "" goto noJava
38 echo Java:
39 echo %JAVA_EXECUTABLE%
40 echo.
41
42:: found java, JAVA_EXECUTABLE env var set, can exit this script
43 goto exit
44
45:tryJava
46if "%JAVA_HOME%" == "" goto noJava
47if not exist "%JAVA_HOME%\bin\java.exe" goto noJava
48 if "%GLILANG%" == "en" (
49 echo.
50 echo ***************************************************************************
51 echo WARNING:
52 echo Found a JAVA_HOME at %JAVA_HOME%. Attempting to use this.
53 echo However, you need to have a Java %DISPLAY_MIN_VERSION% or higher installed.
54 echo ***************************************************************************
55 echo.
56 )
57 :: Try to use this version
58 set JAVA_EXECUTABLE=%JAVA_HOME%\bin\java
59 goto exit
60
61:noJava
62 echo.
63 if "%GLILANG%" == "en" (
64 echo Failed to locate an appropriate version of Java. You must install a
65 echo Java Runtime Environment ^(version %DISPLAY_MIN_VERSION% or greater^) before running the
66 echo Greenstone Librarian Interface.
67 )
68
69 if "%GLILANG%" == "es" (
70 echo No se pudo localizar una versi¢n apropiada de Java. Usted deber
71 echo instalar un Ambiente de Ejecuci¢n Java ^(versi¢n %DISPLAY_MIN_VERSION% o superior^)
72 echo antes de correr la Interfaz de la Biblioteca Digital Greenstone.
73 )
74
75 if "%GLILANG%" == "fr" (
76 echo Une version ad?quate de Java n'a pas pu ?tre localis?e. Vous devez
77 echo installer un Java Runtime Environment ^(version %DISPLAY_MIN_VERSION% ou sup?rieur^)
78 echo avant de d?marrer Greenstone Librarian Interface.
79 )
80
81 if "%GLILANG%" == "ru" (
82 echo ¥ 〠«®áì ®¯à¥€¥«šâì ¬¥áâ®­ 宊€¥­š¥ ᮮ⢥âáâ¢ãî饩 ¢¥àᚚ Java.
83 echo ?ë €®«Š­ë ãáâ ­®¢šâì Java Runtime Environment ^(¢¥àášî %DISPLAY_MIN_VERSION% š«š ¢ëè¥^) ¯¥à¥€ ¢¢®€®¬
84 echo ¡š¡«š®â¥ç­®£® š­â¥à䥩á Greenstone.
85 )
86 goto exit
87
88:exit
89set SEARCH4J_EXECUTABLE=
90set MIN_VERSION=
91set DISPLAY_MIN_VERSION=
Note: See TracBrowser for help on using the repository browser.