Introduction
Apache Tomcat is an open source web server and Java Servlet container. It supports HTML (with CSS and Javascript), jsp (Java Servlet Pages), and most Java-based server technologies, such as Jersey.
Install Tomcat
- Install a Java Development Kit. See Install and Configure Eclipse for Java EE Development
- Browse to Apache Tomcat Downloads
- In the Binary Distribution section, click on 32-bit/64-bit Windows Service Installer (the exe; not the zip)
- Note: I suppose you could download the zip file instead, if you didn’t want to run a server on your PC. I haven’t had much luck with that option.
- Verify the integrity of the download. TODO Add instructions. I haven’t done this lately.
- Run the downloaded installer, using Run As Administrator
- Accept the defaults until you get to the Configuration page
- On the Configuration page, choose a Tomcat Administrator Login user name and password. You’ll use this login later to deploy projects to this server.
- Continue to accept defaults through the rest of the setup.
- Test the running server by browsing to http://localhost:8080
- The browser should show a Tomcat “Hello” page.
- If it doesn’t, the server might not be running. See To Start or Stop the Server, below, to start it.
- If it still doesn’t show the hello page, you’ll need to debug the problem. Another server may be already running on port 8080; the Java or Tomcat configuration may be incorrect.
- On that Tomcat main page, click the Manager App button
- Login using the user name and password you created earlier
- You should then see the Tomcat Web Application Manager
- You can now close your browser.
- Add a Windows Environment Variable named CATALINA_HOME, set to the root folder of your tomcat installation. Something like C:\Program Files\Apache Software Foundation\Tomcat 8.0
- Whenever you want to do Eclipse-based web development, you must first stop this server (see the instructions below). If you don’t, you’ll have two Tomcat servers attempting to listen to the same port – which won’t work well.
To Stop or Start the Server (Windows)
- Click the Windows Start button
- Type View Local Services
- In the resulting window, click on the line labeled Apache Tomcat
- Stop or start the server by clicking the links on the left labeled Stop the service or Start the service
To Add a Project .war file to your server
Tomcat projects are packaged in .war (Web ARchive) format. To add a given .war file to your server:
- TODO add instructions once you have it working. Deployment is pretty easy, but I ran into some problem of running the deployed war file.