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

Last change on this file since 24893 was 24829, checked in by ak19, 12 years ago

Changes to bat files and perl code to deal with brackets in (Windows) filepath. Also checked winmake.bat files to see if changes were needed there. These changes go together with the commits 24826 to 24828 for gems.bat, and commit 24820 on makegs2.bat.

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