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
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%
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
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"
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)"
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.
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