Error in eclipse, servlets

10,841

Solution 1

check project build path whether Servlets api jar file is included or not. you can add it in two ways:

1) add servlets api .jar file to build path
or
2) add server runtime (i add Tomcat server runtime library) in build path

Hope this helps.

Solution 2

You need to add the runtime libraries from your application server.

For example:

Go to project properties. Click Build Path, then the libraries tab. Click add library, then select Server Runtime. Select your server and click OK.

enter image description here

Share:
10,841
user2039136
Author by

user2039136

Updated on June 15, 2022

Comments

  • user2039136
    user2039136 almost 2 years

    Here's some error im getting on Eclipse

        import javax.servlet.RequestDispatcher;
        import javax.servlet.ServletConfig;
        import javax.servlet.ServletException;
        import javax.servlet.http.HttpServlet;
        import javax.servlet.http.HttpServletRequest;
        import javax.servlet.http.HttpServletResponse;
    
        public class HelloServlet extends HttpServlet 
    

    It says HttpServlet cannot be resolved to a type , pls help

  • kamil
    kamil about 11 years
    can you please tell me why you do this? What is the logic behind this, as I have set the classpath in enviroment variables for servlet-api.jar and jsp-api.jar why it not works?