2
Be sure to avoid the pgp and md5 links – you don’t need encrypted downloads.
Choose a location to unpack the .zip or .tar distribution.
On Windows, you probably want to avoid any folders with spaces in their names, so I usually unpack
the distribution right to C:\.
On OS X, a typical location to place such installations is in the /Library folder. You can also choose
the /Applications folder if you like, but many people like to reserve the /Applications folder for GUI
applications.
On other UNIX systems, the typical location is the /usr/local folder. You could also use this folder
on OS X, but /Library is more typically used on that platform as it makes the files accessible via the
Finder.
Using the appropriate program (WinZip is a popular choice on Windows), unpack the folder to the
desired location. On OS X, you should just be able to double-click on the downloaded .tar file.
This will create a folder hierarchy rooted at a folder named apache-tomcat-5.5.23. We will refer to
this folder as CATALINA_HOME in the remainder of this section, and this is the environment variable name
that Tomcat will use to refer to this location.
In case you were wondering, “Catalina” was the code name for Tomcat 4 and it just sort of stuck.
Setting up JAVA_HOME
In order to let Tomcat know where your Java implementation is located, you need to set up the JAVA_HOME
environment variable. Depending upon how you installed Java previously, this might already be defined.
If so, just skip along to the next section.
On Windows, if you’re using Cygwin as your shell you can set up the environment variable as you
would any other in your .bash_profile script. Otherwise, you’ll need to use the Windows Control Panel
to set up JAVA_HOME as a system-level environment variable (Control Panel -> System -> Advanced ->
Environment Variables).
Set the value of the variable JAVA_HOME (case is important!) to point to the root folder of your Java
installation. On my XP system, that folder is C:\jdk1.5.0_06. On my OS X box, its value is set to /
System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home.
On UNIX systems (to include OS X), set up the environment variable in the startup script for your
particular shell (e.g. .bash_profile for the bash shell).
Setting up the Application Contexts
In J2EE parlance, a context is a self-contained web application. A single application server can load and
service many such contexts, keeping requests to each context separate through the use of a unique prefix
in the URL of each request. This prefix is known as the context path.
When a context is defined to the server (we’ll see how to do that in just a bit), it is assigned a unique
context path and the location on the file system that serves as its “root” or document base.
Let’s say that one context is defined with a context path of /abc (context paths always start with a
slash), and another with /xyz. If each has a file named index.jsp at their root folder (document base),
the respective URLs would be:
http://someserver.com:8080/abc/index.jsp
!
Installing and Running Tomcat 5.5