root/other-projects/gs3-webservices-java-client/trunk/gs3democlient.bat @ 32392

Revision 15348, 5.4 KB (checked in by ak19, 12 years ago)

Removed debug output statement, funny character introduced when editing batch file in Linux, and Linux bash-style comments in this Windows batch script

  • Property svn:executable set to *
Line 
1@echo off
2set LANGUAGE=en
3
4
5::  -------- Run the GS3DemoClient on Windows --------
6
7:: This script must be run from within the directory in which it lives
8if exist gs3democlient.bat goto start
9    if "%LANGUAGE%" == "en" echo This script must be run from the directory in which it resides.
10    if "%LANGUAGE%" == "es" echo Este gui¢n deber  ejecutarse desde el directorio en el que reside.
11    if "%LANGUAGE%" == "fr" echo Ce script doit ˆtre ex‚cut‚ … partir du r‚pertoire dans lequel il se trouve.
12    if "%LANGUAGE%" == "ru" echo â®â áªàš¯â €®«Š¥­ ¡ëâì ¢§ïâ š§ €šà¥ªâ®àšš, ¢ ª®â®à®© ®­ à á¯®«®Š¥­
13    goto exit
14
15:start
16
17
18:findJava
19:: ---- Check Java exists ----
20set JAVAPATH=
21
22:: Some users may set the above line manually
23if not "%JAVAPATH%" == "" goto testJava
24
25    :: If it is set, use the JAVA_HOME environment variable
26    if not "%JAVA_HOME%" == "" goto javahome
27
28    :: Check if Java is on the search path
29    echo %PATH%| winutil\which.exe java.exe | winutil\setvar.exe JAVAPATH > setjava.bat
30    call setjava.bat
31    del setjava.bat
32    if not "%JAVAPATH%" == "" goto testJava
33
34    :: Still haven't found anything, so try looking in the registry (gulp!)
35    type nul > jdk.reg
36    regedit /E jdk.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit"
37    type jdk.reg > jdk.txt
38    del jdk.reg
39    type nul > jre.reg
40    regedit /E jre.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment"
41    type jre.reg > jre.txt
42    del jre.reg
43
44    winutil\findjava.exe jdk.txt jre.txt | winutil\setvar.exe JAVAPATH > setjava.bat
45    del jdk.txt
46    del jre.txt
47    call setjava.bat
48    del setjava.bat
49
50    :: If nothing was found in the registry, we're stuck
51    if "%JAVAPATH%" == "" goto noJava
52
53    set JAVAPATH=%JAVAPATH%\bin
54    goto testJava
55
56:javahome
57    set JAVAPATH=%JAVA_HOME%\bin
58
59
60:testJava
61:: Check that a Java executable has been found
62if "%LANGUAGE%" == "en" echo Checking Java: %JAVAPATH%
63if "%LANGUAGE%" == "es" echo Revisando Java: %JAVAPATH%
64if "%LANGUAGE%" == "fr" echo V‚rification de Java: %JAVAPATH%
65if "%LANGUAGE%" == "ru" echo à®¢¥àª  Java: %JAVAPATH%
66if exist "%JAVAPATH%\java.exe" goto checkJavaVersion
67
68:noJava
69    echo.
70    if "%LANGUAGE%" == "en" echo Failed to locate an appropriate version of Java. You must install a
71    if "%LANGUAGE%" == "en" echo Java Runtime Environment (version 1.5 or greater) before running the
72    if "%LANGUAGE%" == "en" echo Greenstone Librarian Interface.
73
74    if "%LANGUAGE%" == "es" echo No se pudo localizar una versi¢n apropiada de Java. Usted deber 
75    if "%LANGUAGE%" == "es" echo instalar un Ambiente de Ejecuci¢n Java (versi¢n 1.5 o superior)
76    if "%LANGUAGE%" == "es" echo antes de correr la Interfaz de la Biblioteca Digital Greenstone.
77
78    if "%LANGUAGE%" == "fr" echo Une version ad‚quate de Java n'a pas pu ˆtre localis‚e. Vous devez
79    if "%LANGUAGE%" == "fr" echo installer un Java Runtime Environment (version 1.5 ou sup‚rieur)
80    if "%LANGUAGE%" == "fr" echo avant de d‚marrer Greenstone Librarian Interface.
81
82    if "%LANGUAGE%" == "ru" echo ¥ 〠«®áì ®¯à¥€¥«šâì ¬¥áâ®­ å®Š€¥­š¥ ᮮ⢥âáâ¢ãî饩 ¢¥àášš Java.
83    if "%LANGUAGE%" == "ru" echo ‚ë €®«Š­ë ãáâ ­®¢šâì Java Runtime Environment (¢¥àášî 1.5 š«š ¢ëè¥) ¯¥à¥€ ¢¢®€®¬
84    if "%LANGUAGE%" == "ru" echo ¡š¡«š®â¥ç­®£® š­â¥àä¥©á  Greenstone.
85    goto exit
86
87
88:checkJavaVersion
89:: ---- Ensure that the JavaVersion is 1.5.x or more, run CheckJavaVersion with <required java version no prefix> <target exec program name> ---
90    "%JAVAPATH%\java" CheckJavaVersion 1.5 GS3democlient
91    if ERRORLEVEL 2 goto checkGS3democlient
92    if ERRORLEVEL 1 goto exit
93
94
95:checkGS3democlient
96:: ---- Check that the GS3democlient has been compiled ----
97if exist "GS3democlient.jar" goto runGS3democlient
98    echo.
99    if "%LANGUAGE%" == "en" echo You need to build the GS3democlient (using "ant build-demo-client")
100    if "%LANGUAGE%" == "en" echo before running this script.
101
102    if "%LANGUAGE%" == "es" echo Usted necesita compilar la GS3democlient
103    if "%LANGUAGE%" == "es" echo (por medio de "ant build-demo-client") antes de ejecutar este gui¢n.
104
105    if "%LANGUAGE%" == "fr" echo Vous devez compiler le GS3democlient (en utilisant "ant build-demo-client")
106    if "%LANGUAGE%" == "fr" echo avant d'ex‚cuter ce script.
107
108    if "%LANGUAGE%" == "ru" echo ‚ë €®«Š­ë ª®¬¯š«šà®¢ âì ¡š¡«š®â¥ç­ë© š­â¥à䥩á GS3democlient
109    if "%LANGUAGE%" == "ru" echo (šá¯®«ì§ãï "ant build-demo-client") ¯¥à¥€ ¢¢®€®¬ í⮣® áªàš¯â 
110    goto exit
111
112
113:runGS3democlient
114:: ---- Finally, run the runGS3democlient ----
115:: Creates new folder "logs", if it does not already exist. Logs dir must exist
116:: for log4j to write output files into. MKDIR/mkdir is a synonym for MD/md
117md "logs"
118echo.
119
120if "%LANGUAGE%" == "en" echo Running the GS3democlient ...
121if "%LANGUAGE%" == "es" echo Ejecutando GS3democlient ...
122if "%LANGUAGE%" == "fr" echo Ex‚cution de GS3democlient
123if "%LANGUAGE%" == "ru" echo ’¥ªãéš© ¡š¡«š®â¥ç­ë© š­â¥à䥩á GS3democlient ...
124
125:: -Xms32M          To set minimum memory
126:: -Xmx32M          To set maximum memory
127:: -verbose:gc      To set garbage collection messages
128:: -Xincgc          For incremental garbage collection
129:: -Xprof           Function call profiling
130:: -Xloggc:<file>   Write garbage collection log
131
132
133:localLib
134    "%JAVAPATH%\java" -jar GS3democlient.jar
135
136:exit
137echo.
138pause
139
140:done
141:: ---- Clean up ----
142set JAVAPATH=
Note: See TracBrowser for help on using the browser.