You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by rj...@apache.org on 2011/06/20 11:50:17 UTC

svn commit: r1137565 - /tomcat/trunk/bin/setclasspath.bat

Author: rjung
Date: Mon Jun 20 09:50:17 2011
New Revision: 1137565

URL: http://svn.apache.org/viewvc?rev=1137565&view=rev
Log:
Make JRE / JDK detection on Windows work
the same way as on Unix:
- if "debug" is demanded, only use JAVA_HOME
  and check for a JDK there
- without "debug", either use JRE_HOME
  or JAVA_HOME with precedence on JRE_HOME

Modified:
    tomcat/trunk/bin/setclasspath.bat

Modified: tomcat/trunk/bin/setclasspath.bat
URL: http://svn.apache.org/viewvc/tomcat/trunk/bin/setclasspath.bat?rev=1137565&r1=1137564&r2=1137565&view=diff
==============================================================================
--- tomcat/trunk/bin/setclasspath.bat (original)
+++ tomcat/trunk/bin/setclasspath.bat Mon Jun 20 09:50:17 2011
@@ -23,35 +23,50 @@ rem $Id$
 rem ---------------------------------------------------------------------------
 
 rem Make sure prerequisite environment variables are set
-if not "%JAVA_HOME%" == "" goto gotJdkHome
+
+rem In debug mode we need a real JDK (JAVA_HOME)
+if ""%1"" == ""debug"" goto needJavaHome
+
+rem Otherwise either JRE or JDK are fine
 if not "%JRE_HOME%" == "" goto gotJreHome
+if not "%JAVA_HOME%" == "" goto gotJavaHome
 echo Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
 echo At least one of these environment variable is needed to run this program
 goto exit
 
-:gotJreHome
-if not exist "%JRE_HOME%\bin\java.exe" goto noJavaHome
-if not exist "%JRE_HOME%\bin\javaw.exe" goto noJavaHome
-if not ""%1"" == ""debug"" goto okJavaHome
-echo JAVA_HOME should point to a JDK in order to run in debug mode.
-goto exit
-
-:gotJdkHome
+:needJavaHome
+rem Check if we have a usable JDK
+if "%JAVA_HOME%" == "" goto noJavaHome
 if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
 if not exist "%JAVA_HOME%\bin\javaw.exe" goto noJavaHome
 if not exist "%JAVA_HOME%\bin\jdb.exe" goto noJavaHome
 if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome
-if not "%JRE_HOME%" == "" goto okJavaHome
 set "JRE_HOME=%JAVA_HOME%"
-goto okJavaHome
+goto okJava
 
 :noJavaHome
-echo The JAVA_HOME environment variable is not defined correctly
+echo The JAVA_HOME environment variable is not defined correctly.
+echo It is needed to run this program in debug mode.
+echo NB: JAVA_HOME should point to a JDK not a JRE.
+goto exit
+
+:gotJavaHome
+rem No JRE given, use JAVA_HOME as JRE_HOME
+set "JRE_HOME=%JAVA_HOME%"
+
+:gotJreHome
+rem Check if we have a usable JRE
+if not exist "%JRE_HOME%\bin\java.exe" goto noJreHome
+if not exist "%JRE_HOME%\bin\javaw.exe" goto noJreHome
+goto okJava
+
+:noJreHome
+rem Needed at least a JRE
+echo The JRE_HOME environment variable is not defined correctly
 echo This environment variable is needed to run this program
-echo NB: JAVA_HOME should point to a JDK not a JRE
 goto exit
-:okJavaHome
 
+:okJava
 if not "%BASEDIR%" == "" goto gotBasedir
 echo The BASEDIR environment variable is not defined
 echo This environment variable is needed to run this program



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org