source: main/trunk/gli/findjava.bat@ 21483

Last change on this file since 21483 was 20655, checked in by ak19, 15 years ago

Updated in sync with the changes Katherine just made to gs2-server.sh and findjava.sh (JAVA_HOME\bin added to the PATH) before launching the webserver so that apache can pass it on to the lucene indexers.

File size: 3.7 KB
Line 
1@echo off
2
3:: Environment Variables passed in: _VERSION, GLILANG and possibly also
4:: GSDLHOME and/or GSDL3SRCHOME.
5:: As a result of executing this script, the JAVA_EXECUTABLE and GS_JAVA_HOME
6:: environment variables 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 :: we know that works, so we can set the local javahome (for Greenstone) as well
43 "%SEARCH4J_EXECUTABLE%" -m "%MIN_VERSION%" -p "%HINT%" | winutil\setvar.exe GS_JAVA_HOME > %TMP%\set_java_home.bat
44 call "%TMP%\set_java_home.bat"
45 del "%TMP%\set_java_home.bat"
46
47:: found java, JAVA_EXECUTABLE and GS_JAVA_HOME env vars set, can exit this script
48 goto exit
49
50:tryJava
51if "%JAVA_HOME%" == "" goto noJava
52if not exist "%JAVA_HOME%\bin\java.exe" goto noJava
53 if "%GLILANG%" == "en" (
54 echo.
55 echo ***************************************************************************
56 echo WARNING:
57 echo Java Runtime not bundled with this Greenstone installation.
58 echo Using JAVA_HOME: %JAVA_HOME%
59 echo ^(NOTE: this needs to be %DISPLAY_MIN_VERSION% or higher.^)
60 echo ***************************************************************************
61 echo.
62 )
63 :: Try to use this version
64 set JAVA_EXECUTABLE=%JAVA_HOME%\bin\java
65 set GS_JAVA_HOME=%JAVA_HOME%
66 goto exit
67
68:noJava
69 echo.
70 if "%GLILANG%" == "en" (
71 echo Failed to locate an appropriate version of Java. You must install a
72 echo Java Runtime Environment ^(version %DISPLAY_MIN_VERSION% or greater^) before running the
73 echo Greenstone Librarian Interface.
74 )
75
76 if "%GLILANG%" == "es" (
77 echo No se pudo localizar una versi¢n apropiada de Java. Usted deber
78 echo instalar un Ambiente de Ejecuci¢n Java ^(versi¢n %DISPLAY_MIN_VERSION% o superior^)
79 echo antes de correr la Interfaz de la Biblioteca Digital Greenstone.
80 )
81
82 if "%GLILANG%" == "fr" (
83 echo Une version ad?quate de Java n'a pas pu ?tre localis?e. Vous devez
84 echo installer un Java Runtime Environment ^(version %DISPLAY_MIN_VERSION% ou sup?rieur^)
85 echo avant de d?marrer Greenstone Librarian Interface.
86 )
87
88 if "%GLILANG%" == "ru" (
89 echo ¥ 〠«®áì ®¯à¥€¥«šâì ¬¥áâ®­ 宊€¥­š¥ ᮮ⢥âáâ¢ãî饩 ¢¥àᚚ Java.
90 echo ?ë €®«Š­ë ãáâ ­®¢šâì Java Runtime Environment ^(¢¥àášî %DISPLAY_MIN_VERSION% š«š ¢ëè¥^) ¯¥à¥€ ¢¢®€®¬
91 echo ¡š¡«š®â¥ç­®£® š­â¥à䥩á Greenstone.
92 )
93 goto exit
94
95:exit
96set SEARCH4J_EXECUTABLE=
97set MIN_VERSION=
98set DISPLAY_MIN_VERSION=
Note: See TracBrowser for help on using the repository browser.