Deploying Your First Java Web Application with Tomcat: A Hands-On Guide for Beginners
This guide demonstrates a hands-on approach to deploying a web application. It builds on the foundation of understanding DevOps and deployment basics. We will walk through downloading Apache Tomcat, building a Java project, and deploying it locally. By the end of this article, you’ll have a working application accessible via http://localhost:8080/
Prerequisites
Ensure you have the following ready:
- Java JDK installed and configured
- Apache Tomcat (we’ll guide you through the download)
- A Java project to deploy (or a simple pre-built project)
Step 1: Download and Set Up Apache Tomcat
Download Tomcat:
- Go to the Apache Tomcat official website. https://tomcat.apache.org/download-90.cgi
- Download the latest version of Tomcat
Extract and Configure:
- Extract the downloaded file to a folder on your machine.
- Familiarize yourself with the directory structure (bin, lib, webapps etc.)
Start the Server:
- Open a terminal and navigate to the bin folder.
- Start Tomcat using the command:
- ./startup.sh (for Linux/Mac)
- Open your browser and verify Tomcat is running by navigating to http://localhost:8080.
Step 2: Build Your Java Project
- Navigate to your Java project directory. You can clone my sample project from here: https://github.com/husnyjiffry/DevOpsGuy
- Use Maven to build your project and generate a .war file. Command: mvn clean install
- The .war file will be available in your project’s target directory.
Step 3: Deploy the Web Application
- Copy the .war file into Tomcat’s webapps folder.
- Restart Tomcat to deploy the application “./shutdown.sh” & “./startup.sh“
- Check deployment logs in the logs folder to ensure the application is deployed successfully.
Step 4: Access Your Application
- Open a browser and go to: http://localhost:8080/webapp/
- Verify that your application is running.
Conclusion
In this tutorial, we’ve covered the essential steps to deploy a Java web application using Apache Tomcat. While this example focuses on local deployment, the process forms the foundation for more complex deployments.
Looking to Automate the Deployment Process?
In this article, we manually deployed a Java web application to Tomcat. If you’d like to learn how to automate this process using Jenkins, check out Automating Java Web Application Deployment with Jenkins: A Step-by-Step Guide. This guide shows you how to streamline deployments and save time by leveraging DevOps tools.

Automating Java Web Application Deployment with Jenkins: A Step-by-Step Guide for Beginners
Read More »Want to understand the fundamentals of deployment and how DevOps streamlines the process? Read👇🏾
That’s it for today, guys. Thank You for Reading! I hope you found this article informative and useful.
If you think it could benefit others, please share it on your social media networks with friends and family who might also appreciate it.
If you find the article useful, please rate it and leave a comment. It will motivate me to devote more time to writing.
If you’d like to support the ongoing efforts to provide quality content, consider contributing via PayNow or Ko-fi. Your support helps keep this resource thriving and improving!
