Prerequisites for Installing Tomcat:
1. Download and install the latest Java(TM) 2 SDK, Standard Edition
Click on Download J2SE SDK under J2SE v 1.4.2_07 SDK
Note - If you install:JRE - Java Runtime Environment, it will only let you run a Java program that has already been compiled
SDK - Software Developers Kit, it will let you can write your own Java programs that you can compile and run.
2. Set Windows Environment Variable JAVA_HOME to the java home directory, and
add java home directory to the Path variable:
Under Control Panel System Advanced Environment Variables Under User Variables Click New
Variable Name: JAVA_HOME
Variable Value: C:\j2sdk1.4.2_07
(make sure you have the right j2sdk directory)
Under Control Panel System Advanced Environment Variables Under System Variables Select Path Click Edit
Add %C:\j2sdk1.4.2_07; at the beginning of the Variable Value.
3. To check your java installation, open a command prompt and type:
C:>java -version
java version "1.4.2_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_07-b05)
Java HotSpot(TM) Client VM (build 1.4.2_07-b05, mixed mode)
C:>java
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-client to select the "client" VM
....
C:>javac
Usage: javac
where possible options include:
-g Generate all debugging info
..........
If you get an error saying that java or javac is not recognized as a batch file
or command, then you have done something wrong with your java installation.
Check JAVA_HOME environment variable, if java/bin directory has the javac
etc., if everything is ok, then try rebooting the machine.
Try these commands to make sure the variables are set properly:
C:\> echo %JAVA_HOME%
C:\> cd %JAVA_HOME%
4. Install a color coded editor to edit xml files, and to write jsp/servlet programs.
Installing Tomcat:
1. Point your browser to http://jakarta.apache.org/tomcat
Click on Download option
Follow the binaries link http://jakarta.apache.org/site/downloads/downloads_tomcat-5.cgi
and download 5.0.28 version or the latest version.
Filename: jakarta-tomcat-5.0.28.tar.gz
2. Create a new folder (say under Program Files\Tomcat), and unzip the
downloaded file there. The sub-folder should contain the following folder's:
bin - starup, shutdown etc., scripts
conf - configuration files such as server.xml, web.xml etc.,
doc - tomcat documentation
lib - jar files
logs - logs files are stored here
src - servlet APIs (empty interfaces and abstract classes implemented by the servlet container)
webapps - web applications
3. Create a new environment variable CATALINA_HOME and set it to Tomcat home dir.
Under Control Panel System Advanced Environment Variables Under User Variables Click New
Variable Name: CATALINA_HOME
Variable Value: C:\Program Files\Tomcat\jakarta-tomcat-5.0.28
(make sure you have the right Tomcat home)
4. Start the Tomcat engine. On a command window, type:
C:\> cd %CATALINA_HOME%
C:\> cd bin
C:\> catalina run
To check this, point your browser to http://localhost:8080
You should see the Apache Tomcat 5.0.28 webpage.
If not, here are somethings to check:
- Check if you already have an existing server (or) another copy of Tomcat
running using the default Tomcat ports (8005, 8009, and 8080).
5. Now stop Tomcat, so that we can configure Tomcat. On a command window, type:
C:\> cd %CATALINA_HOME%
C:\> cd bin
C:\> catalina stop
Configuring Tomcat:
1. Create Development and Deployment workspace Environment Variables to simplify
programming. Example:
DEVELOPMENT_HOME = c:\Program Files\JavaDevelopment\Apps
DEPLOYMENT_HOME = c:\Program Files\JavaDeployment\Apps
2. First, we have to update server.xml under %CATALINA_HOME%\conf
server.xml is the heart of the Tomcat engine, and this allows you to configure Tomcat
using a simple XML descriptor. For more info goto:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/
Make a backup copy of server.xml
Remove all the comments in server.xml.
server.xml should be short and might even fit in a single page.
3. Edit server.xml providing the DEPLOYMENT_HOME directory location
so that Tomcat will know where to find your applications.
click here to view updated portion of server.xml
4. Edit admin.xml and manager.xml under %CATALINA_HOME%\conf\Catalina\localhost
with the correct docBase attributes. We are doing this because we have changed the
appBase attributes in server.xml.
The manager application is for managing web application deployment.
The admin application is for managing the server itself.
manager.xml: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/manager-howto.htmlclick here to view updated admin.xmlclick here to view updated manager.xml