How to Install Apache Tomcat 11 Server on Windows 11

In this guide, we’ll go through the steps to install Apache Tomcat 11 Web Server on Windows 11. Apache Tomcat is an open-source web server and servlet container widely used for running Java applications. This tutorial will help you set up the latest version of Tomcat 11 and verify that it’s running properly on your system.

We can set up Tomcat 11 on Windows 11 using either a zip file or Windows Service Installer. In this post, we will see both ways, but I suggest using Windows Service Installer.

YouTube Video

We recommend watching below the step-by-step video to install and set up the Apache Tomcat 11 web server on Windows 11:

What is Apache Tomcat?

Apache Tomcat is a widely used open-source Java application server that implements the Java Servlet, JavaServer Pages (JSP), and other Java EE specifications. If you want to deploy and run web applications locally, Apache Tomcat 11 is a great choice. This guide will show you how to install Apache Tomcat 11 on Windows 11.

1. Installing Apache Tomcat 11 on Windows 11 using the Windows Service Installer

Why Use the Windows Service Installer?

The Windows Service Installer simplifies the installation process and allows Apache Tomcat to run as a Windows service. This means you can start, stop, and manage Tomcat like any other Windows service, making it easier to control and maintain.

Prerequisites

  1. Java JDK Installed: Apache Tomcat requires Java. Install the latest JDK (e.g., JDK 23) if not already installed. Verify by running:
    java -version
    
    If not installed, refer to our Java JDK 23 installation guide.
  2. Administrator Privileges: Admin rights are needed to install and manage services on Windows.

Step 1: Download Apache Tomcat 11 Windows Service Installer

  1. Open your browser and visit the official Apache Tomcat website: https://tomcat.apache.org.
  2. Navigate to the Tomcat 11 Downloads section.
  3. Under the Core section, find the Windows Service Installer (pgp, sha512) link and click it to download the installer.
How to Install Apache Tomcat 11 Server on Windows 11

Step 2: Install Apache Tomcat 11

  1. Locate the downloaded installer (e.g., apache-tomcat-11.x.xx.exe) in your Downloads folder.

  2. Double-click the installer to begin the installation.

  3. Follow the installation wizard:

    • Setup Type: Choose the components you need. Keep the default selection, which includes Tomcat, documentation, and examples.
    • Tomcat Configuration:
      • Set the HTTP/1.1 Connector port (default is 8080). You can change it if needed.
    • Choose Java: The installer will automatically detect your installed JDK. Ensure the correct JDK path is selected (e.g., C:\Program Files\Java\jdk-23).
    • Service Startup: Select whether Tomcat should start automatically as a service when Windows boots.
  4. Choose the installation location or use the default path (e.g., C:\Program Files\Apache Software Foundation\Tomcat 11).

  5. Click Install to begin the installation process.

Step 3: Verify the Installation

  1. After the installation completes, the installer will offer to start Tomcat immediately. Ensure the checkbox is selected and click Finish.
  2. Open your browser and navigate to:
    http://localhost:8080
    
  3. If installed correctly, you’ll see the Apache Tomcat welcome page.

Step 4: Manage Apache Tomcat as a Windows Service

  1. Open the Services application:
    • Press Win + R, type services.msc, and press Enter.
  2. Scroll down to find Apache Tomcat 11 in the list of services.
  3. Right-click the service to:
    • Start/Stop: Control the Tomcat server.
    • Properties: Configure how the service starts (manual or automatic).

Step 5: Deploy a Web Application

Step 5.1: Using the webapps Folder

  1. Copy your .war file to the webapps directory in the Tomcat installation folder (e.g., C:\Program Files\Apache Software Foundation\Tomcat 11\webapps).
  2. The application will automatically be deployed when the server starts.

Step 5.2: Using the Manager App (Optional)

  1. Navigate to the Manager App via the Tomcat welcome page:
    http://localhost:8080/manager/html
    
  2. Enter the username and password created during installation.
  3. Use the web interface to deploy, undeploy, or manage applications.

Step 6: Configure Apache Tomcat

Update the Server Port (Optional)

If the default port 8080 conflicts with another application:

  1. Open the server.xml file located in the conf directory of your Tomcat installation.
  2. Find the <Connector port="8080" /> line and change the port to a new value (e.g., 8081).
  3. Save the file and restart the Tomcat service.

Configure Memory Settings (Optional)

To optimize Tomcat performance, you can adjust memory settings:

  1. Open the Services app and locate Apache Tomcat 11.
  2. Right-click on it and select Properties.
  3. Under the Java tab, add JVM options such as:
    -Xms512m -Xmx1024m
    
    This allocates a minimum of 512 MB and a maximum of 1 GB of memory to Tomcat.

Step 7: Stop Apache Tomcat Service

To stop Tomcat, either:

  1. Use the Services application to stop the service.
  2. Run the following command in an elevated Command Prompt:
    net stop Tomcat11

Troubleshooting Tips

  • Port Already in Use: Change the HTTP port in the server.xml file to a different port.
  • Service Fails to Start: Ensure the JAVA_HOME environment variable is correctly set.
  • Access Issues with Manager App: Edit the tomcat-users.xml file in the conf folder to create a user with the manager-gui role.

2. Installing Apache Tomcat 11 on Windows 11 using the Zip File

Step 1: Download Apache Tomcat 11

  1. Visit the official Apache Tomcat website: https://tomcat.apache.org.
  2. Navigate to the Tomcat 11 section and click on the Download link.
  3. Under the "Core" section, download the Windows zip file (e.g., apache-tomcat-11.x.xx-windows.zip).

Step 2: Extract the Tomcat Files

  1. Locate the downloaded ZIP file in your Downloads folder.
  2. Right-click on the ZIP file and select Extract All.
  3. Choose a destination folder (e.g., C:\Tomcat11) and click Extract.

Step 3: Configure Apache Tomcat

Step 3.1: Set Up the JAVA_HOME Environment Variable

  1. Open the Start Menu and search for Environment Variables.
  2. Click on Edit the system environment variables.
  3. In the System Properties window, click on Environment Variables.
  4. Under System Variables, click New and:
    • Variable Name: JAVA_HOME
    • Variable Value: The path to your JDK installation (e.g., C:\Program Files\Java\jdk-23).
  5. Click OK to save.

Step 3.2: Verify Java Setup

  1. Open the Command Prompt.
  2. Run the following command to confirm the JAVA_HOME variable is set:
    echo %JAVA_HOME%
    
  3. It should display the path to your JDK.

Step 4: Start Apache Tomcat Server

  1. Navigate to the extracted Tomcat folder (e.g., C:\Tomcat11).
  2. Open the bin folder.
  3. Double-click on the startup.bat file to start the Tomcat server.
  4. A command prompt window will appear, indicating that the Tomcat server has started.

Step 4.1: Verify Tomcat is Running

  1. Open your browser and navigate to:
    http://localhost:8080
    
  2. You should see the Apache Tomcat welcome page.

Step 5: Deploy a Web Application

Step 5.1: Deploying a WAR File

  1. Place your .war file in the webapps folder inside the Tomcat directory.
  2. Restart the Tomcat server by running shutdown.bat followed by startup.bat from the bin folder.
  3. Open your browser and go to:
    http://localhost:8080/<your-app-name>
    

Step 5.2: Accessing the Manager App (Optional)

  1. In the Tomcat welcome page, click on Manager App.
  2. You’ll be prompted for a username and password.
    • To set these, edit the tomcat-users.xml file in the conf directory of Tomcat.
    • Add the following lines inside the <tomcat-users> tags:
      <role rolename="manager-gui"/>
      <user username="admin" password="admin" roles="manager-gui"/>
      
    • Save the file and restart the server.

Step 6: Stop the Apache Tomcat Server

  1. To stop the Tomcat server, navigate to the bin folder.
  2. Double-click on the shutdown.bat file.

Troubleshooting Tips

  • Port Already in Use: If port 8080 is in use, edit the server.xml file in the conf folder. Change the <Connector port="8080" /> line to a different port (e.g., 8081).
  • Access Denied Errors: Run the command prompt as an administrator when starting the server.
  • JAVA_HOME Not Set: Ensure the JAVA_HOME variable points to a valid JDK installation path.

Conclusion

Congratulations! You’ve successfully installed Apache Tomcat 11 on Windows 11 and set up a local server to deploy web applications. Apache Tomcat is an essential tool for Java developers, and with this setup, you’re ready to build and run Java-based web apps. Happy coding!

Comments