source: trunk/gsdl3/gs3-server.bat@ 13619

Last change on this file since 13619 was 13619, checked in by kjdon, 15 years ago

put quotes around classpath in java command

  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 KB
Line 
1@echo off
2set SERVERLANG=en
3
4:: -------- Run the Greenstone 3 Server --------
5
6:: This script must be run from within the directory in which it lives
7if exist gs3-server.bat goto start
8 if "%SERVERLANG%" == "en" echo This script must be run from the directory in which it resides.
9 if "%SERVERLANG%" == "es" echo Este gui¢n deber  ejecutarse desde el directorio en el que reside.
10 if "%SERVERLANG%" == "fr" echo Ce script doit ˆtre ex‚cut‚ 
 partir du r‚pertoire dans lequel il se trouve.
11 if "%SERVERLANG%" == "ru" echo â®â áªàš¯â €®«Š¥­ ¡ëâì ¢§ï⠚§ €šà¥ªâ®àšš, ¢ ª®â®à®© ®­ à á¯®«®Š¥­
12 goto exit
13
14:start
15if "%OS%" == "Windows_NT" goto findGSDL
16 :: Invoke a new command processor to ensure there's enough environment space
17 if "%1" == "Second" goto findGSDL
18 command /E:2048 /C %0 Second %1 %2 %3 %4 %5 %6 %7 %8 %9
19 goto done
20
21:findGSDL
22echo.
23if "%SERVERLANG%" == "en" echo Greenstone3 Server
24if "%SERVERLANG%" == "en" echo Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato
25if "%SERVERLANG%" == "en" echo This program comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt
26if "%SERVERLANG%" == "en" echo This is free software, and you are welcome to redistribute it
27
28echo.
29:: ---- Determine GSDL3HOME ----
30set GSDL3PATH=
31
32:: Some users may set the above line manually
33 if not "%GSDL3PATH%" == "" goto prepGSDL
34
35 :: The default location is the current directory
36 set GSDL3PATH=.
37
38 :: If it is set, use the GSDLHOME environment variable
39 if "%GSDL3SRCHOME%" == "" goto prepGSDL
40 set GSDL3PATH=%GSDL3SRCHOME%
41
42:prepGSDL
43:: Setup Greenstone, unless it has already been done
44if not "%GSDL3SRCHOME%" == "" goto doneGSDL
45 call "%GSDL3PATH%\gs3-setup.bat" SetEnv > nul
46
47:doneGSDL
48:: GSDL3PATH is no longer needed, since GSDL3SRCHOME should now be set
49set GSDL3PATH=
50
51:findJava
52:: ---- Check Java exists ----
53set JAVAPATH=
54
55:: Some users may set the above line manually
56if not "%JAVAPATH%" == "" goto testJava
57
58:: If it is set, use the JAVA_HOME environment variable
59 if not "%JAVA_HOME%" == "" goto javahome
60
61:: Check if Java is on the search path
62 echo %PATH%| winutil\which.exe java.exe | winutil\setvar.exe JAVAPATH > setjava.bat
63 call setjava.bat
64 del setjava.bat
65 if not "%JAVAPATH%" == "" goto testJava
66
67 :: Still haven't found anything, so try looking in the registry (gulp!)
68 type nul > jdk.reg
69 regedit /E jdk.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit"
70 type jdk.reg > jdk.txt
71 del jdk.reg
72 type nul > jre.reg
73 regedit /E jre.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment"
74 type jre.reg > jre.txt
75 del jre.reg
76
77 winutil\findjava.exe jdk.txt jre.txt | winutil\setvar.exe JAVAPATH > setjava.bat
78 del jdk.txt
79 del jre.txt
80 call setjava.bat
81 del setjava.bat
82
83 :: If nothing was found in the registry, we're stuck
84 if "%JAVAPATH%" == "" goto noJava
85
86 set JAVAPATH=%JAVAPATH%\bin
87 goto testJava
88
89:javahome
90 set JAVAPATH=%JAVA_HOME%\bin
91
92:testJava
93:: Check that a Java executable has been found
94 if "%SERVERLANG%" == "en" echo Checking Java: %JAVAPATH%
95 if "%SERVERLANG%" == "es" echo Revisando Java: %JAVAPATH%
96 if "%SERVERLANG%" == "fr" echo V‚rification de Java: %JAVAPATH%
97 if "%SERVERLANG%" == "ru" echo à®¢¥àª  Java: %JAVAPATH%
98 if exist "%JAVAPATH%\java.exe" goto checkServer
99
100:noJava
101 echo.
102 if "%SERVERLANG%" == "en" echo Failed to locate an appropriate version of Java. You must install a
103 if "%SERVERLANG%" == "en" echo Java Runtime Environment (version 1.4 or greater) before running the
104 if "%SERVERLANG%" == "en" echo Greenstone3 Server.
105 goto exit
106
107:checkServer
108::---- Check that the server program has been compiled ----
109if exist "server.jar" goto runServer
110if "%SERVERLANG%" == "en" echo "You need to compile the code before running the server"
111goto exit
112
113:runServer
114echo Running the Greenstone Server
115:: -Xms32M To set minimum memory
116:: -Xmx32M To set maximum memory
117:: -verbose:gc To set garbage collection messages
118:: -Xincgc For incremental garbage collection
119:: -Xprof Function call profiling
120:: -Xloggc:<file> Write garbage collection log
121
122"%JAVAPATH%\java" -cp "%CLASSPATH%" org.greenstone.server.Server "%GSDL3SRCHOME%"
123
124:exit
125
126:done
127:: ---- Clean up ----
128set JAVAPATH=
129
130
131
132
Note: See TracBrowser for help on using the repository browser.