11.2. Starting Tomcat
Problem
You want to get Tomcat running.
Solution
Set the JAVA_HOME and
CATALINA_HOME environment variables, change
directories to Tomcat’s bin
directory, and type startup in Windows or run
startup.sh in Unix.
Discussion
Before starting Tomcat from the command line, you must set these two environment variables:
-
JAVA_HOME You set this environment variable to the installation directory of Java, the parent directory of the Java
bindirectory; e.g.,C:\jdk1.4in Windows or/usr/javain Unix.-
CATALINA_HOME You set this environment variable to the installation directory of Tomcat, the parent directory of the Tomcat
bindirectory; e.g.,C:\tomcat\jakarta-tomcat-5.0.19in Windows.
You can set these environment variables from the command prompt (in Windows that’s the DOS prompt; in Unix it’s the shell) as in this example:
set JAVA_HOME=C:\jdk1.4
How you do this varies by operating system; for example, in the Unix
tcsh shell, use setenv instead.
After setting these environment variables, run Tomcat by changing
directories to Tomcat’s bin
directory and typing startup in Windows, or
running startup.sh in Unix. Note that in Windows,
a new DOS window appears that displays initialization messages. To
shut down Tomcat, type shutdown in Windows, or run
shutdown.sh in Unix at the command line.
Now that you’ve gotten Tomcat running, open a browser, and navigate to http://localhost:8080, which should open Tomcat’s Welcome page, as shown in Figure 11-1. The localhost part of this URL is ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access