source: greenstone3/branches/customizingGreenstone3/gs3-setup.bat@ 14713

Last change on this file since 14713 was 13932, checked in by shaoqun, 17 years ago

make the testing java right

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1@echo off
2
3if exist gs3-setup.bat goto start
4 echo This script must be run from within the Greenstone 3 home directory
5 goto exit
6
7:start
8:: ---- Set the GSDL3HOME variable to the current directory ----
9cd | winutil\setvar.exe GSDL3SRCHOME > setgsdl3.bat
10call setgsdl3.bat
11del setgsdl3.bat
12echo GSDL3SRCHOME: %GSDL3SRCHOME%
13set GSDL3HOME=%GSDL3SRCHOME%\web
14echo GSDL3HOME: %GSDL3HOME%
15
16:: change if using external tomcat
17set TOMCAT_HOME=%GSDL3SRCHOME%\packages\tomcat
18
19:: ---- Set other important environment variables ----
20set GSDLOS=windows
21set PATH=%PATH%;%GSDL3SRCHOME%\bin;%GSDL3SRCHOME%\bin\script;%GSDL3SRCHOME%\lib\jni;
22
23:: ---- Set the CLASSPATH environment variable ----
24set CLASSPATH=.;%GSDL3HOME%\WEB-INF\classes;%GSDL3SRCHOME%\resources\java;%CLASSPATH%
25if exist setcp.bat del setcp.bat
26for %%j in ("%GSDL3SRCHOME%"\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> setcp.bat
27for %%j in ("%GSDL3HOME%"\WEB-INF\lib\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> setcp.bat
28for %%j in ("%GSDL3SRCHOME%"\lib\jni\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> setcp.bat
29for %%j in ("%TOMCAT_HOME%"\common\endorsed\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> setcp.bat
30for %%j in ("%GSDL3SRCHOME%"\build\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> setcp.bat
31
32call setcp.bat
33del setcp.bat
34
35echo CLASSPATH: %CLASSPATH%
36
37::cd %GSDL3HOME%
38
39:findJava
40:: ---- Check Java SDK exists ----
41set JAVAPATH=
42
43:: Some users may set the above line manually
44if not "%JAVAPATH%" == "" goto testJava
45
46:: If it is set, use the JAVA_HOME environment variable
47 if not "%JAVA_HOME%" == "" goto javahome
48
49 :: Check if Java is on the search path
50 echo %PATH%| winutil\which.exe java.exe | winutil\setvar.exe JAVAPATH > setjava.bat
51 call setjava.bat
52 del setjava.bat
53 echo %JAVAPATH%
54 if not "%JAVAPATH%" == "" goto testJava
55
56 :: Still haven't found anything, so try looking in the registry (gulp!)
57 type nul > jdk.reg
58 regedit /E jdk.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit"
59 type jdk.reg > jdk.txt
60 del jdk.reg
61 type nul > jre.reg
62 regedit /E jre.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment"
63 type jre.reg > jre.txt
64 del jre.reg
65
66 winutil\findjava.exe jdk.txt jre.txt | winutil\setvar.exe JAVAPATH > setjava.bat
67 del jdk.txt
68 del jre.txt
69 call setjava.bat
70 del setjava.bat
71
72 :: If nothing was found in the registry, we're stuck
73 if "%JAVAPATH%" == "" goto noJava
74
75 set JAVAPATH=%JAVAPATH%\bin
76 goto testJava
77
78:javahome
79 set JAVAPATH=%JAVA_HOME%\bin
80
81:testJava
82if exist "%JAVAPATH%\java.exe" goto exit
83
84
85:noJava
86 echo.
87 echo Failed to locate an appropriate version of Java. You must install a
88 echo Java Development Kit (version 1.4 or greater) before running the
89 echo Greenstone 3 Digital Library Software.
90 pause
91 goto exit
92
93:exit
94
95
96
Note: See TracBrowser for help on using the repository browser.