This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Tomcat 5.5.23 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat 5.5.23" Watch "Tomcat 5.5.23" New topic
Author

Tomcat 5.5.23

Varuna Seneviratna
Ranch Hand

Joined: Jan 15, 2007
Posts: 167
Hi Can somebody direct me to understand Catalina.bat file after opening it by a text editor and reading it
Thanks Varuna


Varuna Seneviratna
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14193
    
  20

Hello Varuna, what exactly do you want to know about catalina.bat? It is a Windows batch file. Look for example at this for more info about batch files: Windows XP - Using batch files.

Is there something specific that you want to understand about it?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12791
    
    5
The catalina.bat is mainly concerned with manipulating some system environment variables - see the list at the start of the bat for the meaning and usage of these variables.

If it does not find a CATALINA_HOME, it makes a guess.

Then it goes on to check for various stuff, and finally executes one of the commands from the command line - see the list of commands.

Yes - it is hard to figure out exactly what it is doing ;) but you can add "echo" lines as needed to show what is being executed.

Bill
Varuna Seneviratna
Ranch Hand

Joined: Jan 15, 2007
Posts: 167
Help me to Understand what is said below this is an extract of Catalina.bat for Tomcat 5.5.23
<--------------------------------------------------->
rem Guess CATALINA_HOME if not defined
set CURRENT_DIR=%cd%
if not "%CATALINA_HOME%" == "" goto gotHome
set CATALINA_HOME=%CURRENT_DIR%
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
cd ..
set CATALINA_HOME=%cd%
cd %CURRENT_DIR%
:gotHome
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
kHome

rem Get standard environment variables
if exist "%CATALINA_HOME%\bin\setenv.bat" call "%CATALINA_HOME%\bin\setenv.bat"
<------------------------------------------------------------------------>

1 What is the Language used to write this batch file?
2 if not "%CATALINA_HOME%" == "" goto gotHome
//What is meant here? ,What is gotHome
// As I can I understand what it says is If CATALINA_HOME is not equal to "" then go to gotHome, Now at this point if CATALINA_HOME is assigned to a value why is it assigned a another value using the statement
set CATALINA_HOME=%CURRENT_DIR% and what is indicated by % sign

3 if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
1 What is meant here?
2 As I get it If the if conditin is true then go to oKHome
//Please explain the syntax if you can and what is oKHome, what is meant by go to
3 In the next line cd.. what is that
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The link provided by Jesper should explain all of that for you.

A forum on Tomcat is not the best place to go over all the details of Windows batch programming.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14193
    
  20

1 What is the Language used to write this batch file?

Windows batch file control language, see the page where the link in my post above points to.

2 if not "%CATALINA_HOME%" == "" goto gotHome
//What is meant here? ,What is gotHome


It means: If the environment variable CATALINA_HOME does not have no value (so: if it has a value), then jump to the label "gotHome". So "gotHome" is a label. A few lines lower you will see it again, with a colon ":" before it. That's where the control will jump to.

The "set CATALINA_HOME..." statement is executed only if CATALINA_HOME was empty; so that if the user didn't set CATALINA_HOME, then the batch file is guessing what the right value for CATALINA_HOME should be.

The %...% notation is the value of the environment variable.

3 if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
1 What is meant here?


If the file "%CATALINA_HOME%\bin\catalina.bat" exists (where %CATALINA_HOME% is ofcourse the value of the environment variable CATALINA_HOME), jump to the label "okHome".

"cd" is a basic command prompt command which changes the current working directory.
[ July 30, 2007: Message edited by: Jesper Young ]
Varuna Seneviratna
Ranch Hand

Joined: Jan 15, 2007
Posts: 167
Thanks Guys
So this is not a Tomcat file at all it is a Windows file which is used to configure Tomcat on the Windows Platform
Varuna
 
GeeCON Prague 2014
 
subject: Tomcat 5.5.23