The superclass “jakarta.servlet.http.httpservlet” was not found on the java build path

Error: The superclass “jakarta.servlet.http.httpservlet” was not found on the Java Build Path

This error occurs when the specified superclass, in this case, “jakarta.servlet.http.httpservlet”, is not included in the Java Build Path. The Java Build Path is a set of directories or jar files that the Java compiler uses to locate dependency classes.

To resolve this error, you need to add the required library or jar file containing the “jakarta.servlet.http.HttpServletRequest” class to the Java Build Path. Here are the steps to do it:

  1. Identify the library or jar file that contains the “jakarta.servlet.http.httpservlet” class. This class is part of the Jakarta Servlet API and is typically provided by a Servlet container such as Apache Tomcat.
  2. Copy the jar file to a directory in your project. For example, create a “lib” folder in your project’s root directory and place the jar file there.
  3. In your project’s configuration, such as in an IDE like Eclipse, right-click on your project and select “Properties” or “Build Path” or a similar option.
  4. Navigate to the “Build Path” or “Java Build Path” settings.
  5. Click on the “Libraries” or “Classpath” tab.
  6. Click on the “Add JARs” or “Add External JARs” or a similar button.
  7. Select the jar file containing the “jakarta.servlet.http.httpservlet” class from the location where you copied it in step 2.
  8. Click “OK” or “Apply” to save the changes.

After following these steps, the “jakarta.servlet.http.httpservlet” class will be available on the Java Build Path and the error should be resolved.

Related Post

Leave a comment