tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William Bryant <willy...@concentric.net>
Subject Problem found with tomcat.bat on WinNT (with solution)
Date Sat, 03 Jun 2000 07:32:16 GMT
I know, it serves me right for using NT, but I needed a portable demo 
machine and thought I'd test drive Tomcat, too.  I do have a RH 
Linux/Apache/JServ/Cocoon development box that might have qualified as a 
luggable back in 1982.

If I'm the twentieth person this week to point out this particular problem, 
I apologize in advance.  It's hard to believe that this isn't a documented 
problem, but I didn't see anything relevant in the FAQ-o-matic.  I'm using 
NT 4.0 SP4 and Sun JDK 1.1.8, my environment variables (path, classpath, 
tomcat_home) were all set using NT's System control panel.

Anyway, having forgotten how pathetic NT is for such endeavors, I started 
to install Apache and Jakarta on a Pentium laptop.  Apache went in fine and 
I could even run Tomcat with Apache, but in Tomcat's standalone mode the 
batch files would croak, giving me the ever-popular "java usage" message.

I traced down the problem to the tomcat.bat file.  The lines that invoke 
java, such as:

java %TOMCAT_OPTS% -Dtomcat.home="%TOMCAT_HOME%" 
org.apache.tomcat.startup.Tomcat %2 %3 %4 %5 %6 %7 %8 %9

have extraneous quotation marks around %TOMCAT_HOME%.  Once I removed those 
on lines 61, 67, 73, 81, and 87 the batch files worked fine.  I'd be very 
surprised if it didn't cause similar problems in Win9x as well.

Two other minor changes I made include removing a duplicate 'goto cleanup' 
on line 75 and changing the remark 'rem Run ant' on line 85 to 'rem Run 
jspc'.  The fruits of my labor -- such as they are -- appear below.

At the risk of getting drafted into the repair effort, I will also note 
that the Minimalistic User Guide appears to be slightly out of synch with 
the binary distribution (unzips to ./jakarta-tomcat not ./tomcat, etc.)

I look forward to upgrading to Jakarta on my real machine in the near 
future and appreciate the great work done by all the Apache project teams.

-- Willy



******** revised tomcat.bat file *********

@echo off
rem A batch file to start/stop tomcat server.

rem This batch file written and tested under Windows NT
rem Improvements to this file are welcome

rem Guess TOMCAT_HOME if it is not present

if not "%TOMCAT_HOME%" == "" goto gothome

SET TOMCAT_HOME=.
if exist %TOMCAT_HOME%\bin\tomcat.bat goto gothome

SET TOMCAT_HOME=..
if exist %TOMCAT_HOME%\bin\tomcat.bat goto gothome

SET TOMCAT_HOME=
echo Unable to determine the value of TOMCAT_HOME.
goto eof

:gothome

rem Set up the CLASSPATH that we need

set cp=%CLASSPATH%

set CLASSPATH=.
set CLASSPATH=%TOMCAT_HOME%\classes
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\webserver.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\jasper.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xml.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\servlet.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar

if "%cp%" == "" goto next

rem else
set CLASSPATH=%CLASSPATH%;%cp%

:next
if "%1" == "start" goto startServer
if "%1" == "stop" goto stopServer
if "%1" == "run" goto runServer
if "%1" == "env" goto setupEnv
if "%1" == "ant" goto runAnt
if "%1" == "jspc" goto runJspc

echo Usage:
echo tomcat (start^|run^|env^|stop)
echo         start - start tomcat in a separate window
echo         run   - start tomcat in the current window
echo         env   - setup the environment for tomcat
echo         stop  - stop tomcat
echo         ant   - run ant with tomcat context
echo         jspc  - run jsp pre compiler
goto cleanup

:startServer
echo Starting tomcat in new window
echo Using classpath: %CLASSPATH%
start java %TOMCAT_OPTS% -Dtomcat.home=%TOMCAT_HOME% 
org.apache.tomcat.startup.Tomcat %2 %3 %4 %5 %6 %7 %8 %9
goto cleanup

:runServer
rem Start the Tomcat Server
echo Using classpath: %CLASSPATH%
java %TOMCAT_OPTS% -Dtomcat.home=%TOMCAT_HOME% 
org.apache.tomcat.startup.Tomcat %2 %3 %4 %5 %6 %7 %8 %9
goto cleanup

:stopServer
rem Stop the Tomcat Server
echo Using classpath: %CLASSPATH%
java %TOMCAT_OPTS% -Dtomcat.home=%TOMCAT_HOME% 
org.apache.tomcat.startup.Tomcat -stop %2 %3 %4 %5 %6 %7 %8 %9
goto cleanup

:runAnt
rem Run ant
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\ant.jar
echo Using classpath: %CLASSPATH%
java %ANT_OPTS% -Dant.home=%TOMCAT_HOME% -Dtomcat.home=%TOMCAT_HOME% 
org.apache.tools.ant.Main %2 %3 %4 %5 %6 %7 %8

%9
goto cleanup

:runJspc
rem Run jspc
echo Using classpath: %CLASSPATH%
java %JSPC_OPTS% -Dtomcat.home=%TOMCAT_HOME% org.apache.jasper.JspC %2 %3 
%4 %5 %6 %7 %8 %9
goto cleanup

:setupEnv
set cp=%CLASSPATH%

:cleanup
rem clean up

set CLASSPATH=%cp%
set port=
set host=
set test=
set jsdkJars=
set jspJars=
set beanJars=
set miscJars=
set appJars=
set appClassPath=
set cp=

rem pause
:eof


Mime
View raw message