How to Install and Configure Apache Tomcat Server – Beginner Guide
Introduction
To run Servlets and JSP, you need a web server and servlet container.
Apache Tomcat is the most popular and beginner-friendly server used in Java web development.
In this lesson, you will learn:
What Apache Tomcat is
Why it is required for Servlets
How to install Tomcat
How to configure Tomcat with your IDE
How to verify that Tomcat is working
This guide assumes no prior experience with servers.
What Is Apache Tomcat?
Simple Definition:
Apache Tomcat is a web server and servlet container used to run Java Servlets and JSP pages.
In simple words:
Tomcat is the environment where your Servlet code runs.
Why Do We Need Apache Tomcat?
Java Servlets:
Cannot run directly like normal Java programs
Need a Servlet container to manage:
Lifecycle
Requests & responses
Threads
Security
Tomcat provides:
Servlet container
JSP engine
HTTP server support
Without Tomcat, Servlets will not run.
Apache Tomcat Architecture
Browser
↓
Apache Tomcat Server
↓
Servlet / JSP
↓
Java Code & Database
Prerequisites Before Installing Tomcat
Before installing Tomcat, ensure:
Java JDK is installed
JAVA_HOME is set
Java version is verified
Check using:
java -version
If Java version appears, you’re ready.
Downloading Apache Tomcat
Step 1: Choose Tomcat Version
Recommended:
Apache Tomcat 9 or 10 (Beginner-friendly)
Tomcat 9 is widely used and stable for learning Servlets.
Step 2: Download
Download Core → ZIP file
Extract to a folder like:
C:\apache-tomcat-9.0.xx
(Linux/macOS: /opt/tomcat/ or home directory)
Understanding Tomcat Folder Structure
After extraction, you’ll see:
| Folder | Purpose |
|---|---|
bin | Startup & shutdown scripts |
conf | Configuration files |
lib | Libraries |
logs | Server logs |
webapps | Web applications |
work | Temporary compiled files |
webapps is where your projects run.
Starting Apache Tomcat (Manual)
Step 1: Go to bin Folder
apache-tomcat-9.0.xx/bin
Step 2: Start Server
Windows:
startup.batLinux / macOS:
./startup.shStep 3: Verify Installation
Open browser and visit:
http://localhost:8080If Tomcat homepage appears, installation is successful.
Stopping Apache Tomcat
To stop the server:
Windows:
shutdown.batLinux / macOS:
./shutdown.shAlways stop Tomcat properly to avoid issues.
Setting Up Tomcat in Eclipse IDE
Step 1: Open Eclipse
Go to:
Window → Show View → Servers
Step 2: Add New Server
Click New Server
Select Apache → Tomcat
Choose installed Tomcat version
Browse Tomcat installation directory
Select JDK
Finish
Step 3: Start Server in Eclipse
Right-click server → Start
Check console for errors
Eclipse will manage Tomcat automatically.
Setting Up Tomcat in IntelliJ IDEA
Step 1: Configure Application Server
File → Settings → Application Servers
Add Tomcat
Select Tomcat home directory
Step 2: Create Run Configuration
Add Tomcat Server
Deploy your web project
Start server
IntelliJ automatically handles deployment.
Default Tomcat Port & Configuration
Default port: 8080
Configuration file:
conf/server.xmlPort can be changed if needed (advanced topic).