The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path [duplicate] The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path [duplicate] java java

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path [duplicate]


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

Select runtime from Project Facets as shown the in image


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'}


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