Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=39194
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 5 Jul 2009 22:46:51 +0000 (22:46 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 5 Jul 2009 22:46:51 +0000 (22:46 +0000)
Align classpath for all platforms:
 - only add tools.jar to the classpath when required
 - document optional javac argument for catalina.sh|bat
 - make sure javac without generating warnings on start
Include a patch for setclasspath.sh by Jason Brittain

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@791331 13f79535-47bb-0310-9956-ffa450edef68

bin/catalina.bat
bin/catalina.sh
bin/setclasspath.bat
bin/setclasspath.sh

index ef14bb6..5a3e17c 100755 (executable)
@@ -106,8 +106,13 @@ set BASEDIR=%CATALINA_HOME%
 call "%CATALINA_HOME%\bin\setclasspath.bat" %1
 if errorlevel 1 goto end
 
+if "%1" == "javac" shift
 rem Add on extra jar files to CLASSPATH
-set CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\bootstrap.jar
+if "%CLASSPATH%" == "" goto emptyClasspath
+set CLASSPATH=%CLASSPATH%;
+:emptyClasspath
+set CLASSPATH=%CLASSPATH%%CATALINA_HOME%\bin\bootstrap.jar
 
 if not "%CATALINA_BASE%" == "" goto gotBase
 set CATALINA_BASE=%CATALINA_HOME%
@@ -172,7 +177,10 @@ if ""%1"" == ""start"" goto doStart
 if ""%1"" == ""stop"" goto doStop
 if ""%1"" == ""version"" goto doVersion
 
-echo Usage:  catalina ( commands ... )
+echo Usage:  catalina [javac] ( commands ... )
+echo optional arguments:
+echo   javac             Adds tools.jar to the classpath so javac is available
+echo                       as a compiler
 echo commands:
 echo   debug             Start Catalina in a debugger
 echo   debug -security   Debug Catalina with a security manager
index 55ffd61..ce488a7 100755 (executable)
@@ -150,7 +150,10 @@ else
 fi
 
 # Add on extra jar files to CLASSPATH
-CLASSPATH="$CLASSPATH":"$CATALINA_HOME"/bin/bootstrap.jar
+if [ ! -z "$CLASSPATH" ] ; then
+  CLASSPATH="$CLASSPATH":
+fi
+CLASSPATH="$CLASSPATH""$CATALINA_HOME"/bin/bootstrap.jar
 
 if [ -z "$CATALINA_BASE" ] ; then
   CATALINA_BASE="$CATALINA_HOME"
@@ -345,7 +348,10 @@ elif [ "$1" = "version" ] ; then
 
 else
 
-  echo "Usage: catalina.sh ( commands ... )"
+  echo "Usage: catalina.sh [javac] ( commands ... )"
+  echo "optional arguments:"
+  echo "  javac             Adds tools.jar to the classpath so javac is"
+  echo "                      available as a compiler"
   echo "commands:"
   if $os400; then
     echo "  debug             Start Catalina in a debugger (not available on OS400)"
index 71cc5ce..0afb5dd 100755 (executable)
@@ -70,9 +70,14 @@ set JAVA_ENDORSED_DIRS=%BASEDIR%\endorsed
 rem Set standard CLASSPATH
 rem Note that there are no quotes as we do not want to introduce random
 rem quotes into the CLASSPATH
-if not exist "%JAVA_HOME%\lib\tools.jar" goto noJavac
+if not exist "%JAVA_HOME%\lib\tools.jar" goto noJavac2
+if not ""%1"" == ""debug"" goto noJavac1
 set CLASSPATH=%JAVA_HOME%\lib\tools.jar
-:noJavac
+goto noJavac2
+:noJavac1
+if not ""%1"" == ""javac"" goto noJavac2
+set CLASSPATH=%JAVA_HOME%\lib\tools.jar
+:noJavac2
 
 rem Set standard command for invoking Java.
 rem Note that NT requires a window name argument when using start.
index 646afd3..ea7ae42 100755 (executable)
@@ -112,6 +112,9 @@ fi
 if [ "$1" = "debug" -o "$1" = "javac" ] ; then
   if [ -f "$JAVA_HOME"/lib/tools.jar ]; then
     CLASSPATH="$JAVA_HOME"/lib/tools.jar
+    if [ "$1" = "javac" ] ; then
+      shift
+    fi
   fi
 fi