Download and Install Tomcat
For Windows
- Goto http://tomcat.apache.org ⇒ Downloads ⇒ Tomcat 8.0 ⇒ "
8.0.{xx}
" (where{xx}
is the latest upgrade number) ⇒ Binary Distributions ⇒ Core ⇒ "zip" package (e.g., "apache-tomcat-8.0.{xx}.zip
", about 8 MB). - UNZIP into a directory of your choice. DO NOT unzip onto the Desktop (because its path is hard to locate). I suggest using "
d:\myproject
". Tomcat will be unzipped into directory "d:\myproject\apache-tomcat-8.0.{xx}
". For ease of use, we shall shorten and rename this directory to "d:\myproject\tomcat
". Take note of Your Tomcat Installed Directory. Hereafter, I shall refer to the Tomcat installed directory as
(or
- "Catalina" is the codename for Tomcat 5 and above).
apache-tomcat-8.0.{xx}
, but create a symlink called tomcat
via command "mklink /D tomcat apache-tomcat-8.0.{xx}
". Symlink is available in Windows Vista/7/8 only.For Mac
- Goto http://tomcat.apache.org ⇒ Download ⇒ Tomcat 8.0 ⇒ "
8.0.{xx}
" (where{xx}
denotes the latest upgrade number) ⇒ Binary distribution ⇒ Core ⇒ "tar.gz" package (e.g., "apache-tomcat-8.0.{xx}.tar.gz
", about 8 MB). - To install Tomcat:
- Goto "
~/Downloads
", double-click the downloaded tarball (e.g., "apache-tomcat-8.0.{xx}.tar.gz
") to expand it into a folder (e.g., "apache-tomcat-8.0.{xx}
"). - Move the extracted folder (e.g., "
apache-tomcat-8.0.{xx}
") to "/Applications
". - Rename the folder to "tomcat", for ease of use. Take note of Your Tomcat Installed Directory. Hereafter, I shall refer to the Tomcat installed directory as
(or
- "Catalina" is the codename for Tomcat 5 and above).
- Goto "
Set the TCP Port Number ["conf\server.xml"]
The default TCP port number configured in Tomcat is 8080, you may choose any number between 1024 and 65535, which is not used by an existing application. We shall choose 9999 in this article. (For production server, you should use port 80, which is pre-assigned to HTTP server as the default port number.)
Locate the following lines, and change
port="8080"
to port="9999"
.port="9999"
Enabling Directory Listing ["conf\web.xml"]
Again, use a programming text editor to open the configuration file "web.xml
", under the "conf
" sub-directory of Tomcat installed directory.We shall enable directory listing by changing "
listings
" from "false
" to "true
" for the "default
" servlet. This is handy for test system, but not for production system for security reasons.Locate the following lines and change from "
false
" to "true
".default org.apache.catalina.servlets.DefaultServlet debug 0 listings true 1
Enabling Automatic Reload ["conf\context.xml"]
We shall add the attribute
reloadable="true"
to the
element to enable automatic reload after code changes. Again, this is
handy for test system but not for production, due to the overhead of
detecting changes.Locate the
start element, and change it to
.> ......reloadable="true"
Optional ["conf\tomcat-users.xml"]
Enable the Tomcat's manager by adding the highlighted lines, inside the
elements:This enables the manager GUI app for managing Tomcat server.
Starting TOMCAT
For Windows
Launch a CMD shell. Set the current directory to ">\bin
", and run "startup.bat
" as follows:
// Change the current directory to Tomcat's "bin" // Assume that Tomcat is installed in "d:\myproject\tomcat" > d: // Change the current drive d:\> cd \myproject\tomcat\bin // Change Directory to YOUR Tomcat's "bin" directory // Start Tomcat Server D:\myproject\tomcat\bin> startup
For Mac
I assume that Tomcat is installed in "
I assume that Tomcat is installed in "
/Applications/tomcat
". To start the Tomcat server, open a new "Terminal" and issue:// Change current directory to Tomcat's binary directory $ cd /Applications/tomcat/bin // Start tomcat server $ ./catalina.sh run
Client Access
use bellow link to access
Http://host:port/appfolder
Stopping TOMCAT
For Windows
You can shutdown the tomcat server by either:- Press ctrl-c on the Tomcat console; or
- Run "
" script:\bin\shutdown.bat // Change the current directory to Tomcat's "bin" > d: // Change the current drive d:\> cd \myproject\tomcat\bin // Change Directory to YOUR Tomcat's "bin" directory // Shutdown the server d:\myproject\tomcat\bin> shutdown
For Mac
To shutdown the Tomcat server:
To shutdown the Tomcat server:
- Press control-c (NOT command-c); or
- Run the "
" script. Open a new "Terminal" and issue:/bin/shutdown.sh // Change current directory to Tomcat's bin directory $ cd /Applications/tomcat/bin // Shutdown the server $ ./shutdown.sh
WARNING: You MUST properly shutdown the Tomcat. DO NOT kill the cat by pushing the window's "CLOSE" button.
No comments:
Post a Comment