javax.servlet.http.HttpServlet was not found on the Java Build Path

The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path

This issue occurs if server run time not set in the project. To set server run time:

  • Right click project
  • Click properties
  • Java Build Path
  • Add Library –> Click Next

javax.servlet.http.HttpServlet was not found on the Java Build Path
Choose Server run time (For demo its Apache Tomcat 7.0) –> Click Finish — OK
javax.servlet.http.HttpServlet was not found on the Java Build Path

26 thoughts on “javax.servlet.http.HttpServlet was not found on the Java Build Path”
  1. It is not working for me… I have everything you said, but the error remains:

    The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path

  2. Thank You. There is another short cut way to make same chage after opening the property window click on the “Target Runtime” and then check the Apache Server.
    Cheers.

  3. Hello,

    Im having the same issue. But it didnt fix my problem. Problem occurs on the very first line.

    There is no wavy red line, just the red “X” dot saying the superclass is missing.

    1. If you are using maven project add java.servlet-api dependency from here:
      otherwise add servlet-api.jar in your project classpath and please let me know if this fix your issue.

      1. Im using spring IDE. It wont let me build the project from maven. It gives me an error message. “Invalid Project Description”.

        I must admit, I dont care much for the spring mvc framework. It’ not even MVC. It uses jsp with logic blended with the html markup. JSF is far superior.

  4. after making changes as you said, m getting these error
    Build path contains duplicate entry: ‘org.eclipse.jst.server.core.co…rver Developer Edition (Runtime) v3.1’ for project ‘StrutsHibernate’

    Do u hv any idea???

  5. nd m getting these error as well
    Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    … 1 more

Leave a Reply

Your email address will not be published. Required fields are marked *