Changeset 15071 for greenstone3/trunk/gs3-setup.bat
- Timestamp:
- 2008-03-07T15:06:04+13:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
greenstone3/trunk/gs3-setup.bat
r15051 r15071 1 1 @echo off 2 2 3 ::get user defined environment variable 4 set JRE_HOME= 5 set JAVA_HOME= 6 set CLASSPATH= 3 if exist machine.bat call machine.bat 7 4 8 5 if exist gs3-setup.bat goto start … … 12 9 :start 13 10 :: ---- Set the GSDL3HOME variable to the current directory ---- 14 cd | winutil\setvar.exe GSDL3SRCHOME > setgsdl3.bat 15 call setgsdl3.bat 16 del setgsdl3.bat 17 echo GSDL3SRCHOME: %GSDL3SRCHOME% 11 cd | winutil\setvar.exe GSDL3SRCHOME > %SystemRoot%\Temp\setgsdl3.bat 12 call %SystemRoot%\Temp\setgsdl3.bat 13 del %SystemRoot%\Temp\setgsdl3.bat 18 14 set GSDL3HOME=%GSDL3SRCHOME%\web 19 echo GSDL3HOME: %GSDL3HOME%20 15 21 16 :: change if using external tomcat … … 27 22 28 23 :: ---- Set the CLASSPATH environment variable ---- 24 if "%GS_CP_SET%" == "yes" goto skipSetCp 29 25 set CLASSPATH=.;%GSDL3HOME%\WEB-INF\classes;%GSDL3SRCHOME%\resources\java;%CLASSPATH% 30 if exist setcp.bat del setcp.bat 31 for %%j in ("%GSDL3SRCHOME%"\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> setcp.bat 32 for %%j in ("%GSDL3HOME%"\WEB-INF\lib\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> setcp.bat 33 for %%j in ("%GSDL3SRCHOME%"\lib\jni\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> setcp.bat 34 for %%j in ("%TOMCAT_HOME%"\common\endorsed\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> setcp.bat 35 for %%j in ("%GSDL3SRCHOME%"\build\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> setcp.bat 26 if exist %SystemRoot%\Temp\setcp.bat del %SystemRoot%\Temp\setcp.bat 27 for %%j in ("%GSDL3SRCHOME%"\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> %SystemRoot%\Temp\setcp.bat 28 for %%j in ("%GSDL3HOME%"\WEB-INF\lib\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> %SystemRoot%\Temp\setcp.bat 29 for %%j in ("%GSDL3SRCHOME%"\lib\jni\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> %SystemRoot%\Temp\setcp.bat 30 for %%j in ("%TOMCAT_HOME%"\common\endorsed\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> %SystemRoot%\Temp\setcp.bat 31 for %%j in ("%GSDL3SRCHOME%"\build\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> %SystemRoot%\Temp\setcp.bat 32 call %SystemRoot%\Temp\setcp.bat 33 del %SystemRoot%\Temp\setcp.bat 34 :skipSetCp 36 35 37 call setcp.bat 38 del setcp.bat 36 winutil\launcher.exe -find | winutil\setvar.exe _JRE_HOME > %SystemRoot%\Temp\set_jre_home.bat 37 call %SystemRoot%\Temp\set_jre_home.bat 38 del %SystemRoot%\Temp\set_jre_home.bat 39 39 40 goto findJREHOME 40 echo %_JRE_HOME%\bin\java.exe | winutil\setvar.exe RUNJAVA > %SystemRoot%\Temp\setrunjava.bat 41 call %SystemRoot%\Temp\setrunjava.bat 42 del %SystemRoot%\Temp\setrunjava.bat 41 43 42 :: ---- Check JRE_HOME ---- 43 :findJREHOME 44 if not "%JRE_HOME%" == "" goto testJREHOME 45 goto findJREHOME2 44 if "%JRE_HOME%" == "" set JRE_HOME=%_JRE_HOME% 46 45 47 ::---- try JREHOME ---- 48 :findJREHOME2 49 if "%JREHOME%" == "" goto findJAVAHOME 50 set JRE_HOME=%JREHOME% 51 testJREHOME 52 53 ::test JRE_HOME is set correctly 54 :testJREHOME 55 if exist "%JRE_HOME%\bin\java.exe" goto gotJREHOME 56 echo JRE_HOME: "%JRE_HOME%" 57 echo Couldn't find "%JRE_HOME%\bin\java.exe" 58 echo The JRE_HOME environment variable is not defined correctly 59 echo This environment variable is needed to run this program 60 goto pauseANdExit 61 62 63 ::set the RUNJAVA and exit 64 :gotJREHOME 65 set RUNJAVA=%JRE_HOME%\bin\java.exe 66 set PATH=%JRE_HOME%\bin;%PATH% 67 echo JRE_HOME: "%JRE_HOME%" 68 echo Your environment has successfully been set up to run Greenstone3 69 goto exit 70 71 72 :: ---- check JAVA_HOME ---- 73 :findJAVAHOME 74 if not "%JAVA_HOME%" == "" goto testJAVAHOME 75 goto findJAVAHOME2 76 77 78 ::---- check JAVAHOME ---- 79 :findJAVAHOME2 80 if "%JAVAHOME%" == "" goto noJAVAHOME 81 set JAVA_HOME=%JAVAHOME% 82 testJAVAHOME 83 84 85 :: test JAVA_HOME is set Correctly 86 :testJAVAHOME 87 if not exist "%JAVA_HOME%\bin\java.exe" goto wrongJAVAHOME 88 if not exist "%JAVA_HOME%\bin\javac.exe" goto wrongJAVAHOME2 89 goto gotJAVAHOME 90 91 92 :wrongJAVAHOME 93 echo JAVA_HOME: "%JAVA_HOME%" 94 echo Couldn't find "%JAVA_HOME%\bin\java.exe" 95 echo The JAVA_HOME environment variable is not defined correctly 96 echo This environment variable is needed to run this program 97 goto pauseANdExit 98 99 :wrongJAVAHOME2 100 echo JAVA_HOME: "%JAVA_HOME%" 101 echo Couldn't find "%JAVA_HOME%\bin\javac.exe" 102 echo The JAVA_HOME environment variable is not defined correctly 103 echo This environment variable is needed to run this program 104 echo NB: JAVA_HOME should point to a JDK not a JRE 105 goto pauseANdExit 106 107 ::set the RUNJAVA and exit 108 :gotJAVAHOME 109 set RUNJAVA=%JAVA_HOME%\bin\java.exe 110 set PATH=%JAVA_HOME%\bin;%PATH% 111 echo JAVA_HOME: "%JAVA_HOME%" 112 echo Your environment has successfully been set up to run Greenstone3 113 goto exit 114 115 ::try find java on the search path 116 :noJAVAHOME 117 :: Check if Java is on the search path 118 echo %PATH%| winutil\which.exe java.exe | winutil\setvar.exe JAVAPATH > setjava.bat 119 call setjava.bat 120 del setjava.bat 121 122 if exist "%JAVAPATH%\bin\java.exe" goto gotJava 123 :: Still haven't found anything, so try looking in the registry (gulp!) 124 type nul > jdk.reg 125 regedit /E jdk.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit" 126 type jdk.reg > jdk.txt 127 del jdk.reg 128 type nul > jre.reg 129 regedit /E jre.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment" 130 type jre.reg > jre.txt 131 del jre.reg 132 133 winutil\findjava.exe jdk.txt jre.txt | winutil\setvar.exe JAVAPATH > setjava.bat 134 del jdk.txt 135 del jre.txt 136 call setjava.bat 137 del setjava.bat 138 139 :: If nothing was found in the registry, we're stuck 140 if "%JAVAPATH%" == "" goto noJava 141 goto gotJava 142 143 :gotJava 144 set JRE_HOME=%JAVAPATH% 145 goto testJREHOME 146 147 148 :noJava 149 echo Neither the JAVA_HOME nor the JRE_HOME environment variable is defined 150 echo At least one of these environment variable is needed to run Greenstone3 151 echo You must install a Java Run Environment (version 1.4 or greater) 152 echo and set the JRE_HOME environment variable before running the 153 echo Greenstone 3 Digital Library Software. 154 pause 155 goto exit 156 157 :pauseAndExit 158 pause 159 goto exit 160 161 :exit 162 163 164 46 echo GSDL3SRCHOME : %GSDL3SRCHOME% 47 echo GSDL3HOME : %GSDL3HOME% 48 echo JVM : %RUNJAVA%
Note:
See TracChangeset
for help on using the changeset viewer.