Hoe To set up Java and Apache Tomcat on your Windows PC for local development

To set up Java and Apache Tomcat on your Windows PC for local development, follow these steps.


Step 1 — Install Java (JDK)

Tomcat requires Java.

Recommended Version

Use:

  • Java 17 (LTS)

Recommended vendors:

I recommend Eclipse Temurin JDK 17.


Step 2 — Download and Install JDK

Installation Steps

  1. Download:

    • Windows x64 MSI installer

  2. Install to:

C:\Program Files\Java\jdk-17

Step 3 — Set JAVA_HOME

Open Environment Variables

Press:

Windows + R

Type:

sysdm.cpl

Then:

Advanced → Environment Variables

Create JAVA_HOME

System Variables → New

VariableValue
JAVA_HOMEC:\Program Files\Java\jdk-17

Update PATH

Edit Path variable and add:

%JAVA_HOME%\bin

Step 4 — Verify Java Installation

Open CMD:

java -version

Expected:

java version "17.x.x"

Also check:

javac -version

Step 5 — Download Apache Tomcat

Recommended:

  • Tomcat 10.1

Download from:

Apache Tomcat Downloads

Download:

64-bit Windows zip

Step 6 — Extract Tomcat

Extract to:

C:\Tomcat

You should see:

C:\Tomcat\bin
C:\Tomcat\webapps
C:\Tomcat\conf

Step 7 — Set CATALINA_HOME

Add Environment Variable:

VariableValue
CATALINA_HOMEC:\Tomcat

Step 8 — Start Tomcat

Go to:

C:\Tomcat\bin

Run:

startup.bat

You should see:

Tomcat started

Step 9 — Verify Tomcat

Open browser:

http://localhost:8080

You should see:

Apache Tomcat Welcome Page

Step 10 — Stop Tomcat

Run:

shutdown.bat

Recommended Folder Structure

C:\
 ├── Tomcat
 ├── Projects
 ├── Java
 └── Workspace

Deploy Your First JSP Application


Step 11 — Create Sample App

Go to:

C:\Tomcat\webapps

Create folder:

testapp

Inside create:

index.jsp

Contents:

<html>
<body>
<h2>FMS Local Tomcat Working</h2>
</body>
</html>

Step 12 — Access Application

Open:

http://localhost:8080/testapp

Recommended IDE

Best Option

Eclipse IDE for Enterprise Java Developers

Alternative:


Configure Tomcat in Eclipse

In Eclipse

Window
 → Preferences
   → Server
      → Runtime Environments

Add:

Apache Tomcat v10

Select:

C:\Tomcat

Recommended Software Stack for FMS Local Development

SoftwareRecommended
JDKJava 17
Tomcat10.1
IDEEclipse
DatabaseOracle XE / Oracle Client
Build ToolMaven
GitGit for Windows

Install Maven (Recommended)

Download:

Apache Maven

Set:

MAVEN_HOME

Add to PATH:

%MAVEN_HOME%\bin

Verify:

mvn -version

Common Tomcat Problems

Port Already in Use

Error:

8080 already in use

Fix:

Edit:

C:\Tomcat\conf\server.xml

Change:

port="8080"

to:

port="9090"

JAVA_HOME Not Set

Error:

JAVA_HOME environment variable not defined

Fix:

  • Verify environment variable.


JSP Not Working

Ensure:

  • JDK installed (not only JRE)



Post a Comment

And that's all there is to it!

If anyone has any other questions or requests for future How To posts, you can either ask them in the comments or email me. Please don't feel shy at all!

I'm certainly not an expert, but I'll try my hardest to explain what I do know and research what I don't know.

Previous Post Next Post