You are here
Home > How To > How To Install Tomcat 8 On Windows

How To Install Tomcat 8 On Windows


As of September 2017, Tomcat 9 is at the alpha stage, not a stable release. So We are going to install Tomcat 8.5.11.

Step 1: Download and Install Tomcat 8

  • Goto ⇒ Under Downloads ⇒ Under “Tomcat 8” ⇒ Binary Distributions ⇒ Core ⇒ Click on “ZIP” package (e.g. you will get “”, about 9 MB).
  • Create your server directory into day drive, say “c:\servers” , “d:\servers” or “e:\servers”. UNZIP the downloaded file into your server directory. Tomcat will be unzipped into directory e.g., “e:\servers\apache-tomcat-8.0.20”.
  • For ease of use, we shall shorten and rename this directory to “e:\servers\tomcat8”.

Note : e:\servers\tomcat8 is tomcat install home directory

Step 2: Create an Environment Variable JAVA_HOME

You need to create an environment variable called “JAVA_HOME” and set it to your JDK installed directory.

  • First, find your JDK installed directory. The default is “c:\Program Files\Java\jdk1.8.0_{xx}”. memorize of your JDK installed directory or copy paste into somewhere.
  • To set the environment variable JAVA_HOME in Windows 7/8/10: Start “Control Panel” ⇒ System and Security (Optional) ⇒ System ⇒ Advanced system settings ⇒ Switch to “Advanced” tab ⇒ Environment Variables ⇒ System Variables ⇒ “New” ⇒ In “Variable Name”, enter “JAVA_HOME” ⇒ In “Variable Value”, enter your JDK installed directory as copied or noted in previous step.

STEP 3: Configure Tomcat Server

The Tomcat configuration files are located in the “conf” sub-directory of your Tomcat installed directory, e.g. “e:\servers\tomcat8\conf”. There are 4 configuration XML files:

  1. server.xml
  2. web.xml
  3. context.xml
  4. tomcat-users.xml

Step 3(1): “conf\server.xml” – Set the TCP Port Number

  • Use a any programming text editor (e.g., NotePad++, TextPad, Sublime, Atom) to open the configuration file “server.xml”, under the “conf” sub-directory of Tomcat installed directory.
  • 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 2017 in this article. (For a production server, you should use default port number 80, which is pre-assigned to HTTP server.)
  • Locate the following lines (around Line 69) that define the HTTP connector, and change port=”8080″ to port=”2017″.
<!– A “Connector” represents an endpoint by which requests are received and responses are returned. –>
<Connector port=”2017″ protocol=”HTTP/1.1″
redirectPort=”8443″ />

Step 3(b): “conf\web.xml” – Enabling Directory Listing

  • 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 a test system, but due to security reasons not for a production system.
  • Locate the following lines (around Line 103) that define the “default” servlet, and change the “listings” from “false” to “true”.

Step 3(c): “conf\context.xml” – Enabling Automatic Reload

  • 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 “Context” start element (around Line 19), and change it to given below.
<Context reloadable=”true>

Step 3(d): (Optional) “conf\tomcat-users.xml”

  • Enable the Tomcat’s manager by adding the below code:
<role rolename=”manager-gui”/>
<user username=”manager” password=”XXXXXXXX” roles=”manager-gui”/>

STEP 4: Start Tomcat Server

  • The Tomcat’s executable programs and scripts are kept in the “bin” sub-directory of the Tomcat installed directory, e.g., “e:\servers\tomcat8\bin”
  • Launch a CMD shell. Set the current directory to “\bin” e.g. “e:\servers\tomcat8\bin
  • Run “startup.bat”
// Change the current directory to Tomcat’s “bin”
// Assume that Tomcat is installed in “e:\servers\tomcat8\bin”
e: // Change the current drive
cd \servers\tomcat8\bin // Change Directory to YOUR Tomcat’s “bin” directory

// Start Tomcat Server

Step 5: Shutdown Server
You can shutdown the tomcat server by either:

  • Press Ctrl-C on the Tomcat console; OR
  • Run “\bin\shutdown.bat” script.
// Change the current directory to Tomcat’s “bin”
e: // Change the current drive
cd \servers\tomcat8\bin // Change Directory to YOUR Tomcat’s “bin” directory

// Shutdown the server

Jay Prakash Kumar
If you have come this far, it means that you liked what you are reading. Why not reach little more and connect with me directly on Facebook or Twitter. Jay Prakash is a founder of Professional Hacker, Technical Writer, Software Developer, Security Analyst and Technology Enthusiast with a keen eye on the Cyber-world and other technology-related developments.

One thought on “How To Install Tomcat 8 On Windows

Comments are closed.