Apache Tomcat Local Development Guide
Run Apache Tomcat on localhost, default port 8080, deploy Java web applications, and access via http://localhost:8080.
Apache Tomcat is an open-source Java Servlet container used for running JSP and Servlet applications. When developing Java web projects locally, Tomcat is one of the most commonly used localhost environments.
Default localhost Access
| Purpose | Address |
|---|---|
| Default Home | http://localhost:8080 |
| Management UI | http://localhost:8080/manager/html |
Tomcat listens on port 8080 by default (to avoid conflicts with Apache on port 80).
Installation and Startup
- Download the appropriate version of Tomcat for your JDK from tomcat.apache.org.
- Extract it to a local directory, such as
/opt/tomcatorC:\tomcat. - Run
bin/startup.sh(Linux/macOS) orbin\startup.bat(Windows). - Open a browser and navigate to http://localhost:8080 to see the Tomcat welcome page, indicating success.
Deploying Applications
Place the WAR file in the webapps/ directory, or extract it into a folder with the same name:
webapps/myapp.war → http://localhost:8080/myapp/
webapps/demo/ → http://localhost:8080/demo/IDEs (IntelliJ IDEA, Eclipse) can also be configured to run/debug Tomcat directly.
Changing the Port
Edit conf/server.xml, find Connector port="8080", change it to another port like 9090, and restart to use http://localhost:9090.
Common Issues
Port 8080 is Occupied
Change the port in server.xml, or close the program occupying port 8080 (such as another Tomcat instance or certain built-in IDE services).
404 Page
Ensure the application is deployed in webapps and the context path is correct.
JDK Version Mismatch
Tomcat 10+ requires Jakarta EE (Java 11+), ensure it matches the Servlet API version of your project.
Summary
Tomcat is the standard container for local Java web development, accessible at http://localhost:8080. Simply place your WAR file in webapps to access it.