eclipse – The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path

eclipse – The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path

Add a runtime first and select project properties. Then check the server name from the Runtimes tab as shown in the image.

Select

Include servlet-api-3.1.jar in your dependencies.

  • Maven

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
        <scope>provided</scope>
    </dependency>
    
  • Gradle

    configurations {
        provided
    }
    sourceSets {
        main { compileClasspath += configurations.provided }
    }
    dependencies {
        provided javax.servlet:javax.servlet-api:3.1.0
    }
    

eclipse – The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path

Project → PropertiesTarget RuntimesApache Tomcat worked for me. There is no Target Runtimes under Facets (Im on Eclipse v4.2 (Juno)).

Leave a Reply

Your email address will not be published.