I'm using Eclipse 3.6 Helios (for Java Developers) and want to add the javax.servlet package to one of my projects. What do I need to configure/download?
Quick Fix- This worked in Eclipse - Right Click on project -> Properties -> Java Build Path (Tab) -> Add External JARs -> locate the servlet api jar implementation (if Tomcat - its named servlet-api. jar) -> click OK. That's it !!
An abstract class that simplifies writing HTTP servlets. It extends the GenericServlet base class and provides an framework for handling the HTTP protocol. Because it is an abstract class, servlet writers must subclass it and override at least one method.
Right-click your project, click on properties->Java Build path->Libraries tab->click Add External JARs->Browse for servlet-api. jar and select it->click OK to update the build path. Right-click the project, click properties->Java Build Path->click ADD JARs->find servlet-api.
To expound on darioo's answer with a concrete example. Tomcat 7 installed using homebrew on OS X, using Eclipse:
What? No Tomcat version is listed even though you have it installed via homebrew??
Hope that helps someone who is just getting started out a little.
Right click on your project -> properties -> build path. Add to your build path jar
file(s) that have the javax.servlet
implemenation. Ite depends on your servlet container or application server what file(s) you need to include, so search for that information.
When you define a server in server view, then it will create you a server runtime library with server libs (including servlet api), that can be assigned to your project. However, then everybody that uses your project, need to create the same type of runtime in his/her eclipse workspace even for compiling.
If you directly download the servlet api jar, than it could lead to problems, since it will be included into the artifacts of your projects, but will be also present in servlet container.
In Maven it is much nicer, since you can define the servlet api interfaces as a "provided" dependency, that means it is present in the "to be production" environment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With