Changeset 19353

Show
Ignore:
Timestamp:
08.05.2009 12:42:48 (10 years ago)
Author:
ak19
Message:

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.

Location:
gli/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • gli/trunk/client-gli.bat

    r19346 r19353  
    6868 
    6969:findJava 
    70 :: ---- Check Java exists ---- 
    71 set JAVAPATH= 
    72  
    73 :: Some users may set the above line manually 
    74 if not "%JAVAPATH%" == "" goto testJava 
    75  
    76     :: If it is set, use the JAVA_HOME environment variable 
    77     if not "%JAVA_HOME%" == "" goto javahome 
    78  
    79     :: Check if Java is on the search path 
    80     echo %PATH%| winutil\which.exe java.exe | winutil\setvar.exe JAVAPATH > setjava.bat 
    81     call setjava.bat 
    82     del setjava.bat 
    83     if not "%JAVAPATH%" == "" goto testJava 
    84  
    85     :: Still haven't found anything, so try looking in the registry (gulp!) 
    86     type nul > jdk.reg 
    87     regedit /E jdk.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit" 
    88     type jdk.reg > jdk.txt 
    89     del jdk.reg 
    90     type nul > jre.reg 
    91     regedit /E jre.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment" 
    92     type jre.reg > jre.txt 
    93     del jre.reg 
    94  
    95     winutil\findjava.exe jdk.txt jre.txt | winutil\setvar.exe JAVAPATH > setjava.bat 
    96     del jdk.txt 
    97     del jre.txt 
    98     call setjava.bat 
    99     del setjava.bat 
    100  
    101     :: If nothing was found in the registry, we're stuck 
    102     if "%JAVAPATH%" == "" goto noJava 
    103  
    104     set JAVAPATH=%JAVAPATH%\bin 
    105     goto testJava 
    106  
    107 :javahome 
    108     set JAVAPATH=%JAVA_HOME%\bin 
    109  
    110 :testJava 
    111 :: Check that a Java executable has been found 
    112 if "%GLILANG%" == "en" echo Checking Java: %JAVAPATH% 
    113 if "%GLILANG%" == "es" echo Revisando Java: %JAVAPATH% 
    114 if "%GLILANG%" == "fr" echo V‚rification de Java: %JAVAPATH% 
    115 if "%GLILANG%" == "ru" echo à®¢¥àª  Java: %JAVAPATH% 
    116 if exist "%JAVAPATH%\java.exe" goto checkGLI 
    117  
    118 :noJava 
    119     echo. 
    120     if "%GLILANG%" == "en" echo Failed to locate an appropriate version of Java. You must install a 
    121     if "%GLILANG%" == "en" echo Java Runtime Environment (version 1.4 or greater) before running the 
    122     if "%GLILANG%" == "en" echo %PROGNAME_EN%. 
    123  
    124     if "%GLILANG%" == "es" echo No se pudo localizar una versi¢n apropiada de Java. Usted deber  
    125     if "%GLILANG%" == "es" echo instalar un Ambiente de Ejecuci¢n Java (versi¢n 1.4 o superior) 
    126     if "%GLILANG%" == "es" echo antes de correr la Interfaz de la %PROGFULLNAME%. 
    127  
    128     if "%GLILANG%" == "fr" echo Une version ad‚quate de Java n'a pas pu ˆtre localis‚e. Vous devez 
    129     if "%GLILANG%" == "fr" echo installer un Java Runtime Environment (version 1.4 ou sup‚rieur) 
    130     if "%GLILANG%" == "fr" echo avant de d‚marrer %PROGNAME_EN%. 
    131  
    132     if "%GLILANG%" == "ru" echo ¥ 〠«®áì ®¯à¥€¥«šâì ¬¥áâ®­ å®Š€¥­š¥ ᮮ⢥âáâ¢ãî饩 ¢¥àášš Java. 
    133     if "%GLILANG%" == "ru" echo ‚ë €®«Š­ë ãáâ ­®¢šâì Java Runtime Environment (¢¥àášî 1.4 š«š ¢ëè¥) ¯¥à¥€ ¢¢®€®¬ 
    134     if "%GLILANG%" == "ru" echo ¡š¡«š®â¥ç­®£® š­â¥àä¥©á  %PROGNAME%. 
    135     goto exit 
    136  
     70:: Need to find Java. If found, JAVA_EXECUTABLE will be set 
     71call findjava.bat 
     72if "%JAVA_EXECUTABLE%" == "" goto exit 
    13773 
    13874:checkGLI 
     
    177113:: on the client side. If we have Perl, pass the gs2build dir with the -gsdl flag and the PERLPATH. 
    178114if "%PERLPATH%" == "" goto :nogsdl 
    179     "%JAVAPATH%\java" -Xmx128M -cp classes/;GLI.jar;lib/apache.jar;lib/qfslib.jar org.greenstone.gatherer.GathererProg -use_remote_greenstone -gsdl %~dp0gs2build -perl %PERLPATH% %1 %2 %3 %4 %5 %6 %7 %8 %9 
     115    "%JAVA_EXECUTABLE%" -Xmx128M -cp classes/;GLI.jar;lib/apache.jar;lib/qfslib.jar org.greenstone.gatherer.GathererProg -use_remote_greenstone -gsdl %~dp0gs2build -perl %PERLPATH% %1 %2 %3 %4 %5 %6 %7 %8 %9 
    180116    goto finish 
    181117 
    182118:nogsdl 
    183 "%JAVAPATH%\java" -Xmx128M -cp classes/;GLI.jar;lib/apache.jar;lib/qfslib.jar org.greenstone.gatherer.GathererProg -use_remote_greenstone %1 %2 %3 %4 %5 %6 %7 %8 %9 
     119"%JAVA_EXECUTABLE%" -Xmx128M -cp classes/;GLI.jar;lib/apache.jar;lib/qfslib.jar org.greenstone.gatherer.GathererProg -use_remote_greenstone %1 %2 %3 %4 %5 %6 %7 %8 %9 
    184120 
    185121:finish 
     
    198134set PERLPATH= 
    199135set JAVAPATH= 
     136set JAVA_EXECUTABLE= 
    200137popd 
  • gli/trunk/findjava.bat

    r19336 r19353  
    11@echo off 
    22 
    3 :: Environment Variables passed in: _VERSION and GLILANG 
     3:: Environment Variables passed in: _VERSION, GLILANG and  
     4:: possibly also GSDLHOME and/or GSDL3SRCHOME. 
    45:: As a result of executing this script, the JAVA_EXECUTABLE variable  
    56:: will be set, but only if Perl was found. 
    67 
     8:findJava 
    79 
    8 :findJava 
    9     if "%_VERSION%" == "2" ( 
     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" ( 
    1023        set SEARCH4J_EXECUTABLE=%GSDLHOME%\bin\windows\search4j.exe 
    1124        set HINT=%GSDLHOME%\packages\jre 
    1225    ) 
    13     if "%_VERSION%" == "3" ( 
     26        if "%_VERSION%" == "3" ( 
    1427        set SEARCH4J_EXECUTABLE=%GSDL3SRCHOME%\bin\search4j.exe 
    1528        set HINT=%GSDL3SRCHOME%\packages\jre 
    1629    ) 
    17      
    18     "%SEARCH4J_EXECUTABLE%" -e -m "1.4.0_00" -p "%HINT%" | winutil\setvar.exe JAVA_EXECUTABLE > %TMP%\set_java_executable.bat 
     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 
    1934    call "%TMP%\set_java_executable.bat" 
    2035    del "%TMP%\set_java_executable.bat" 
     
    2843    goto exit 
    2944 
     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 
    3061:noJava 
    3162    echo. 
    3263    if "%GLILANG%" == "en" ( 
    3364        echo Failed to locate an appropriate version of Java. You must install a 
    34             echo Java Runtime Environment ^(version 1.4 or greater^) before running the 
     65            echo Java Runtime Environment ^(version %DISPLAY_MIN_VERSION% or greater^) before running the 
    3566            echo Greenstone Librarian Interface. 
    3667    ) 
     
    3869    if "%GLILANG%" == "es" ( 
    3970        echo No se pudo localizar una versi¢n apropiada de Java. Usted deber  
    40             echo instalar un Ambiente de Ejecuci¢n Java ^(versi¢n 1.4 o superior^) 
     71            echo instalar un Ambiente de Ejecuci¢n Java ^(versi¢n %DISPLAY_MIN_VERSION% o superior^) 
    4172            echo antes de correr la Interfaz de la Biblioteca Digital Greenstone. 
    4273    ) 
     
    4475    if "%GLILANG%" == "fr" ( 
    4576        echo Une version ad?quate de Java n'a pas pu ?tre localis?e. Vous devez 
    46             echo installer un Java Runtime Environment ^(version 1.4 ou sup?rieur^) 
     77            echo installer un Java Runtime Environment ^(version %DISPLAY_MIN_VERSION% ou sup?rieur^) 
    4778            echo avant de d?marrer Greenstone Librarian Interface. 
    4879    ) 
     
    5081    if "%GLILANG%" == "ru" ( 
    5182        echo ¥ 〠«®áì ®¯à¥€¥«šâì ¬¥áâ®­ 宊€¥­š¥ ᮮ⢥âáâ¢ãî饩 ¢¥àᚚ Java. 
    52             echo ?ë €®«Š­ë ãáâ ­®¢šâì Java Runtime Environment ^(¢¥àášî 1.4 š«š ¢ëè¥^) ¯¥à¥€ ¢¢®€®¬ 
     83            echo ?ë €®«Š­ë ãáâ ­®¢šâì Java Runtime Environment ^(¢¥àášî %DISPLAY_MIN_VERSION% š«š ¢ëè¥^) ¯¥à¥€ ¢¢®€®¬ 
    5384            echo ¡š¡«š®â¥ç­®£® š­â¥àä¥©á  Greenstone. 
    5485    ) 
     
    5788:exit 
    5889set SEARCH4J_EXECUTABLE= 
     90set MIN_VERSION= 
     91set DISPLAY_MIN_VERSION=