javax.servlet is in Java EE (not SE). But if I'm not mistaken, it's also included as part of the Tomcat installation. I believe you want the following 3 items added to your CLASSPATH (where ... depends on where exactly these are installed on your system):
1. Click on the Libraries Tab (while still under Properties�>Java Build Path). 2. Click Add Variable. 3. Select ECLIPSE_HOME and click Extend. 4. Navigate to the plugins/org.eclipse.tomcat.4.1.x directory. 5. Select servlet.jar and click OK. 6. Click OK to exit the properties dialog.
Originally posted by Rusty Shackleford: Sure it does, at least when compiling on the command line. I haven't tried it using eclipse.
I have to tell you, again, that as Bear says, whether Tomcat (or any other servlet container) is running or not has absolutely nothing to do with compiling servlets -- although if you'd like to explain to me how you think these things are related, I'd sit and listen because I'm interested in hearing about it. Maybe you're thinking about compiling JSPs?
The interfaces one needs to compile against are in common/lib/servlet-api.jar in the Tomcat distribution. As long as the compiler can see that file (i.e., it's on the class path) then you can compile servlets.