Eclipse Tomcat


What are the overall steps that we must do in order to use Tomcat inside Eclipse?

  1. Download and install Tomcat (see the tomcat-linux page)
  2. Add Tomcat to Eclipse

How can add Tomcat to Eclipse?

You must be using a version of Eclipse that included WTP, which is the plug-in responsible for managing embedded servers, such as Tomcat. I recommend eclipse-indigo, for stability - but newer JEE Eclipse versions should work as well - here's a link to the indigo version:

I also recommend overriding some of the eclipse.ini settings, such as setting these: -Xms64m / -Xmx2048m

It's also a good idea to use a JDK to run Eclipse, instead of a basic JVM - you can add something like this to your eclipse.ini:

-vm C:/dev/tools/jdk17u45/bin/javaw.exe

Add these classpath variables (Preferences > Java > Build Path > Classpath Variables):

  • TOMCAT_JDK = C:/dev/tools/jdk17u25/ (or whatever path to your working JDK)
  • PARSERS_DIR=(path to the 'parsers' directory in your project's codebase)

To add Tomcat to Eclipse:

  1. Click on Windows -> Show View -> Servers
  2. Right click anywhere in the Servers view and select "New -> Server"
  3. Drill down on Apache
  4. Select appropriate version of Tomcat
  5. Click Next
  6. Specify the location where we previously installed Tomcat
  7. Click Finish

Now, we can stop and start Tomcat from inside the Servers view. After we made change to our code, we can right click on the project and select "Run As -> Run on Server". If we double-click on the server under the Servers tab, it should display a page where we can configure the server. One of the option would allow us to live reload the class when we save it without us having to do a manual deploy.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License