Using the Eclipse Web Tools Platform
with Apache Tomcat
This discussion is continued from here. And we're specifically talking about gaining access to the Tomcat servlet library we use.
Right click on the project, wtp-tutorial, choose Build Path and Configure Build Path. You get a dialog box entitled, Java Build Path with tabs. The Libraries tab here should already be set up to include Apache Tomcat which contains the servlet-api.jar that you would otherwise have to include manually.
You may need to worry about this because you're missing this JAR getting errors out of the compiler about missing imports like:
You may need to add a library by hand. To do this, click on the Libraries tab, then Add Library..., click on Server Runtime, then Next >, and, finally, Apache Tomcat v6.0, if you're using the same version of Tomcat that I am in this tutorial.
Or, this failing, try clicking on Libraries tab, then Add External JARs..., and browse down under the apache-tomcat-6.0.16/lib subdirectory where you installed Tomcat to find it. However, you should have met with success using the method in the previous paragraph.
Once you've added Tomcat libraries to your build path, you should be able to expand Apache Tomcat v6.0 and see the servlet library in question. This is illustrated below.
It's very important that you install the JEE version of Eclipse because it resolves much or all of this for you.
Continue on with the rest of the tutorial by clicking on the back arrow or here.