File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes IDEs, Version Control and other tools and the fly likes Servlet cannot be resolved. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Servlet cannot be resolved." Watch "Servlet cannot be resolved." New topic

Servlet cannot be resolved.


Joined: Apr 04, 2006
Posts: 4
Hi I am having a problem with Eclipse. When I try to code servlets and I import javax.servlet Eclipse says that it cannot be resolved. How can I get right. Thanks in advance.
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
You need to add a JAR file (one that contains javax.servlet.* stuff) to your project's classpath.

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33134

This would be the j2ee.jar or servlets.jar that comes with your application/web server.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Servlet cannot be resolved.
jQuery in Action, 3rd edition