source: gsdl/trunk/findjava.bat@ 20636

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

Better warning message when the findjava scripts have to resort to using what's in JAVA_HOME.

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 Java Runtime not bundled with this Greenstone installation.
53 echo Using JAVA_HOME: %JAVA_HOME%
54 echo ^(NOTE: this needs to be %DISPLAY_MIN_VERSION% or higher.^)
55 echo ***************************************************************************
56 echo.
57 )
58 :: Try to use this version
59 set JAVA_EXECUTABLE=%JAVA_HOME%\bin\java
60 goto exit
61
62:noJava
63 echo.
64 if "%GLILANG%" == "en" (
65 echo Failed to locate an appropriate version of Java. You must install a
66 echo Java Runtime Environment ^(version %DISPLAY_MIN_VERSION% or greater^) before running the
67 echo Greenstone Librarian Interface.
68 )
69
70 if "%GLILANG%" == "es" (
71 echo No se pudo localizar una versi¢n apropiada de Java. Usted deber
72 echo instalar un Ambiente de Ejecuci¢n Java ^(versi¢n %DISPLAY_MIN_VERSION% o superior^)
73 echo antes de correr la Interfaz de la Biblioteca Digital Greenstone.
74 )
75
76 if "%GLILANG%" == "fr" (
77 echo Une version ad?quate de Java n'a pas pu ?tre localis?e. Vous devez
78 echo installer un Java Runtime Environment ^(version %DISPLAY_MIN_VERSION% ou sup?rieur^)
79 echo avant de d?marrer Greenstone Librarian Interface.
80 )
81
82 if "%GLILANG%" == "ru" (
83 echo ¥ 〠«®áì ®¯à¥€¥«šâì ¬¥áâ®­ 宊€¥­š¥ ᮮ⢥âáâ¢ãî饩 ¢¥àᚚ Java.
84 echo ?ë €®«Š­ë ãáâ ­®¢šâì Java Runtime Environment ^(¢¥àášî %DISPLAY_MIN_VERSION% š«š ¢ëè¥^) ¯¥à¥€ ¢¢®€®¬
85 echo ¡š¡«š®â¥ç­®£® š­â¥à䥩á Greenstone.
86 )
87 goto exit
88
89:exit
90set SEARCH4J_EXECUTABLE=
91set MIN_VERSION=
92set DISPLAY_MIN_VERSION=
Note: See TracBrowser for help on using the repository browser.