In Java. web applications are usually deployed as WAR files (or extracted directories in the exact same format as a WAR file). A WAR file is a regular ZIP file (like a JAR) that contains some extra structure and files, in particular a /META-INF/web.xml
file that describes the components of your web application.
Eclipse is smart and allows you to cheat by running web applications without any special packaging or deployment, straight from the IDE.
Your best bet is to learn a tool like Maven, Ant or Gradle, and have it create a WAR file out of your project. Eclipse also has an option to export a WAR File directly. Once that's done, copy the WAR file to Apache Tomcat's webapps
directory, where it will be available under the path /foo
for a WAR named foo.war
. To serve as the root application (/
), name the WAR ROOT.war
. When you start Apache Tomcat (or if it's running, when you copy the WAR file) you should see a message on the console/log informing you that the application has been deployed.
For more information on creating WAR files, see the Stack Overflow question "How to create war files"