Apache Tomcat Windows Quick Start Guide

Using Apache Tomcat in a Windows environment might seem simple enough, given that all Windows distributions include an installer to do all the Tomcat configuration work for you.  However, while the installer will get Tomcat up and running for most users, quite a few others can find themselves encountering frustrating errors due to differences in version, missing DLLs, and other small, hard to track down issues.

If you are one of these frustrated users, you're in the right place.  In this article, we'll methodically guide you through the Windows Tomcat install and configuration process, from download to configuring Tomcat as a Windows service.  As we go, we'll point out potential problem areas and provide you with easy workarounds, to get you started with Tomcat on Windows in no time. The latest version of Tcat makes installing multiple Tomcat instances as Windows Services easier than ever. Download Tcat and try for yourself!

Choosing the Correct Distribution

Apache provides a variety of different Windows distributions of Tomcat with components designed to support specific chip architectures.  Before you install Tomcat on your Windows machine, you should make sure that the distribution you have downloaded is correct for your machine and JVM.

(Note: If you are planning on using the EXE package to install Apache Tomcat, you can skip ahead, as this package includes both 32- and 64-bit distributions of Tomcat, and will automatically choose the appropriate package for your system.)

In order to choose the correct package, you need information about your chip architecture and version of Windows.  If you don't know this information, follow these instructions:

Windows 7 or Vista Users 

  1. Right click the "Computer" icon in the Start Menu, and choose "Properties" from the context menu.
  2. Click the System Tab.  You should see a list of information about your system, including your chip architecture and whether you are running a 32- or 64-bit version of Windows.

Windows XP Users

  1. Right click the "My Computer" icon in the Start Menu, and choose "Properties" from the context menu.
  2. Under the "System" header, if you see the entry "x64 edition", you are running a 64-bit version of Windows.  Otherwise, you are running at 32-bit version.

If you are running a 32-bit version of Windows, you MUST use a 32-bit distribution of Apache Tomcat, as well as a 32-bit JDK.  

If you are using a 64-bit system, you can technically run either a 32- or 64-bit distribution, as long as the bit architecture of the JDK you have installed matches your Tomcat distribution.  However, the Tomcat installer automatically requires that 64-bit operating systems use the 64-bit version of Tomcat, so you'll have to manually install the lower-bit version.  

(Note that there is no notable Tomcat performance difference between the different bit versions that makes one a better choice than the other.)

In summary, the easiest route with the least possibility of error is to ensure that your JDK, Tomcat distribution, Operating System, and CPU all support the same architecture.

Setting Environment Variables

Before installing Tomcat, you should ensure that your environment variables are  set correctly, so that Tomcat will be able to find your Java libraries.  In a Windows environment, this can be done on a per-user basis without access the command line:

  1. Right click "Computer" or "My Computer" in the Start Menu and choose "Properties" from the context menu.
  2. Under the "Advanced" tab, you can define new variables.
  3. Set the JAVA_HOME variable to point to your JDK's main directory (i.e. C:/path/to/jdkx.x, not the bin directory).
  4. Additionally, add %JAVA_HOME%\jre\bin to the PATH variable, which will help prevent possible problems with orphaned DLL files across Windows versions.

Installing Tomcat with the Windows Installer

Using the Windows EXE distribution is by far the easiest way to get Tomcat up and running on your Windows machine.  As this is a quick-start guide, it is recommended that you use this option.  

Simply download the "Windows Service Installer" package from the Apache website and run the .exe file, which will be called something like "apache-tomcat-6.x.x.exe".  In addition to moving the binaries into place, the installer will prompt you to configure a few critical variables, such as the location of your JVM, your default HTTP connector port, and your administrator login, that you will otherwise have to configure yourself.  

If you don't want to use the installer you can visit our easy guide to Tomcat Configuration for more information about manual installation and configuration.

After finishing your installation, you will be given the option to run Tomcat on exit.  Select this option, and click Finish to launch the Tomcat server.  If your installation was successful, you should be able to use your web browser to access the Tomcat welcome page at http://localhost:8080/, and you should see a new Apache Tomcat Manager icon on your Toolbar displaying a small green arrow, indicating that your server is running.

The Manager application (not to be confused with Tomcat's Manager web application) is a Windows-specific GUI tool for interacting with the Tomcat server.  You can double-click it to start or shutdown the server, or set a variety of server options.

Tomcat as a Windows Service

Running the Windows installer automatically installs Tomcat as a Windows Service.  Windows Services, similar to daemons on Unix based systems, are processes that are owned by the system, and work in the background without user intervention.  Running Tomcat as a service allows you to start Tomcat automatically on login, among other things.  

You can configure the Tomcat service from the desktop by double-clicking the Manager tray icon, navigating to the "General" tab, and choosing "Automatic" for the "Startup type".

For more advanced information about the Tomcat Windows Service, please see our helpful how-to article on the Tomcat Service.  

Common Errors and How To Fix Them

Although Tomcat set-up for Windows environments seems fairly straightforward, there are a number of issues can trip up new users unfamiliar with the way that Windows handles permissions and dependencies.  Here are a few common problems experienced by Windows-based Tomcat users and how to work around them.

UAC Permissions Problems

UAC, or user access control, is used by some versions of Windows to restrict access to programs that could potentially make a system vulnerable to malicious users.  As a web server, Tomcat falls under this umbrella.  

If you encounter any errors relating to lack of permissions, make sure that you right-click all Tomcat-related programs and choose "Run As Administrator".  This is necessary even if you are logged in as an administrator, due to the way that Windows handles user roles.  

Alternatively, you can disable UAC altogether:

1. Open the Start Menu and choose "Run".  Enter "MSCONFIG" and hit Enter to open the System Configuration utility.

2.  Find "Disable UAP" under the "Tools Tab", select it, and click Launch.

Environmental Variables

If you set JAVA_HOME correctly at the beginning of this tutorial, and correctly specified the path to your JVM in Tomcat's installation wizard, you should not have any problems with environmental variables.  

However, if you receive any errors related to missing Java runtimes, something has probably gotten confused.  Perhaps you installed two different JDK and chose the wrong directory.  To fix this problem, investigate your configuration, or, if you don't need to save any data, simple do a fresh install of both your JDK and Tomcat.

Note that users who configure Tomcat by hand are more likely to experience problems with variables than users who use the Windows installer.