echo off pushd "%CD%" CD /D "%~dp0" set GLILANG=en :: This script must be run from within the directory in which it lives if exist makejar.bat goto findJar if "%GLILANG%" == "en" echo This script must be run from the directory in which it resides. if "%GLILANG%" == "es" echo Este guiвn deberа ejecutarse desde el directorio en el que reside. if "%GLILANG%" == "fr" echo Ce script doit Иtre exВcutВ Е partir du rВpertoire dans lequel il se trouve. if "%GLILANG%" == "ru" echo Этот скрипт должен быть взят из директории, в которой он расположен goto exit :findJar :: ---- Check jar exists ---- set JARPATH= :: Some users may set the above line manually if not "%JARPATH%" == "" goto testJar :: If it is set, use the JAVA_HOME environment variable if not "%JAVA_HOME%" == "" goto javahome :: Check if jar is on the search path echo %PATH%| winutil\which.exe jar.exe | winutil\setvar.exe JARPATH > setjar.bat call setjar.bat del setjar.bat if not "%JARPATH%" == "" goto testJar :: Still haven't found anything, so try looking in the registry (gulp!) type nul > jdk.reg regedit /E jdk.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit" type jdk.reg > jdk.txt del jdk.reg winutil\findjava.exe jdk.txt | winutil\setvar.exe JARPATH > setjar.bat del jdk.txt call setjar.bat del setjar.bat :: If nothing was found in the registry, we're stuck if "%JARPATH%" == "" goto noJar set JARPATH=%JARPATH%\bin goto testJar :javahome set JARPATH=%JAVA_HOME%\bin :testJar :: Check that a jar executable has been found if "%GLILANG%" == "en" echo Checking jar: %JARPATH% if "%GLILANG%" == "es" echo Revisando jar: %JARPATH% if "%GLILANG%" == "fr" echo VВrification de jar: %JARPATH% if "%GLILANG%" == "ru" echo Проверка jar: %JARPATH% if exist "%JARPATH%\jar.exe" goto checkCompile :noJar echo. if "%GLILANG%" == "en" echo Failed to locate an appropriate version of jar. You must install a if "%GLILANG%" == "en" echo Java Development Kit (version 1.4 or greater) before compiling the if "%GLILANG%" == "en" echo Greenstone Librarian Interface. if "%GLILANG%" == "es" echo No se pudo localizar una versiвn apropiada de jar. Usted deberа if "%GLILANG%" == "es" echo instalar un Kit de Desarrollo de Software Java (versiвn 1.4 o superior) if "%GLILANG%" == "es" echo antes de generar la documentaciвn para la Interfaz de la Biblioteca if "%GLILANG%" == "es" echo Digital Greenstone. if "%GLILANG%" == "fr" echo Une version appropriВe de jar n'a pas pu Иtre localisВe. Vous devez if "%GLILANG%" == "fr" echo installer un Kit de DВveloppement Java (version 1.4 ou supВrieure) if "%GLILANG%" == "fr" echo avant de produire la documentation de Greenstone Librarian Interface. if "%GLILANG%" == "ru" echo Не удалось определить местонахождение соответствующей версии jar. if "%GLILANG%" == "ru" echo Вы должны инсталлировать Java Development Kit (версия 1.4 или выше) if "%GLILANG%" == "ru" echo прежде, чем генерировать документацию для библиотечного if "%GLILANG%" == "ru" echo интерфейса Greenstone. goto exit :checkCompile :: Check that the GLI has been compiled if exist classes\org\greenstone\gatherer\GathererProg.class goto makeJar if "%GLILANG%" == "es" ( echo Usted necesita compilar la Interfaz de la Biblioteca Digital Greenstone echo ^(por medio de makegli.sh^) antes de ejecutar este guiєn. ) if "%GLILANG%" == "fr" ( echo Vous devez compiler le Greenstone Interface ^(en utilisant makegli.sh^) echo avant d'exщcuter ce script. ) if "%GLILANG%" == "ru" ( echo ў┘ ─╧╠╓╬┘ ╦╧═╨╔╠╔╥╧╫┴╘╪ ┬╔┬╠╔╧╘┼▐╬┘╩ ╔╬╘┼╥╞┼╩╙ Greenstone echo ^(╔╙╨╧╠╪┌╒╤ makegli.sh^) ╨┼╥┼─ ╫╫╧─╧═ ▄╘╧╟╧ ╙╦╥╔╨╘┴ ) if "%GLILANG%" == "en" ( echo You need to compile the Greenstone Librarian Interface ^(using makegli.sh^) echo before running this script. ) goto exit fi :makeJar :: All the GLI class files and supporting libraries are put into the "jar" directory echo Assuming that Java code is freshly compiled... if NOT exist jar ( mkdir jar cd jar "%JARPATH%\jar" xf ..\lib\apache.jar com org "%JARPATH%\jar" xf ..\lib\qfslib.jar de cd .. ) :: Copy the latest version of the GLI classes into the jar directory if exist jar\org\greenstone ( rmdir /q /s jar\org\greenstone ) xcopy /i /e /q classes\org\greenstone jar\org\greenstone :: Some of the things to go into the JAR file are optional, and may not exist set optional= if exist collect.zip ( set optional=%optional% collect.zip ) :: Recreate the metadata.zip file (contains the GLI metadata directory) if exist metadata.zip ( del /f metadata.zip ) winutil\zip.exe -r metadata.zip metadata >NUL :: Jar everything up "%JARPATH%\jar" cf GLI.jar .java.policy metadata.zip %optional% help -C classes dictionary.properties -C classes dictionary_es.properties -C classes dictionary_fr.properties -C classes dictionary_ru.properties -C classes feedback.properties -C classes images -C classes xml -C jar com -C jar de -C jar org :: Tidy up del /f metadata.zip :: Generate the GLIServer.jar file for remote building "%JARPATH%\jar" cf GLIServer.jar -C classes org/greenstone/gatherer/remote :: ---- Make signed JAR file for the applet, if desired ---- if (%1) == (-sign) ( if not exist appletstore ( "%JARPATH%\keytool" -genkey -alias privateKey -keystore appletstore -storepass greenstone ) if exist SignedGatherer.jar del /f SignedGatherer.jar if exist appletpasswd ( echo Using jarsigner to make signed jar file ... "%JARPATH%\jarsigner" -keystore appletstore -signedjar SignedGatherer.jar GLI.jar privateKey < appletpasswd >NUL 2>NUL echo ... done. ) ELSE ( "%JARPATH%\jarsigner" -keystore appletstore -signedjar SignedGatherer.jar GLI.jar privateKey ) echo Installing SignedGatherer in ..\bin\java move SignedGatherer.jar ..\bin\java\SignedGatherer.jar ) :exit popd