From: markt Date: Sun, 5 Jul 2009 22:46:51 +0000 (+0000) Subject: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=39194 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=8c2c146b46d757513f9c722abbdfe81d9be152a8;p=tomcat7.0 Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=39194 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 --- diff --git a/bin/catalina.bat b/bin/catalina.bat index ef14bb683..5a3e17c46 100755 --- a/bin/catalina.bat +++ b/bin/catalina.bat @@ -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 diff --git a/bin/catalina.sh b/bin/catalina.sh index 55ffd6141..ce488a71c 100755 --- a/bin/catalina.sh +++ b/bin/catalina.sh @@ -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)" diff --git a/bin/setclasspath.bat b/bin/setclasspath.bat index 71cc5cef8..0afb5dd27 100755 --- a/bin/setclasspath.bat +++ b/bin/setclasspath.bat @@ -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. diff --git a/bin/setclasspath.sh b/bin/setclasspath.sh index 646afd3f4..ea7ae4290 100755 --- a/bin/setclasspath.sh +++ b/bin/setclasspath.sh @@ -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