The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path 解决方法

错误重现:

项目中某一.jps页面忽然出现错误,鼠标点上去为:The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path.

原因:

eclipse只要更改了工作空间或者biuld目录,之前的配置就会归零,具体原因不详,因为我在建新项目的时候更改了导致tomcat无法使用出了这个问题

解决:

就是把tomcat重新配置一遍,配置方法网上有很多,这里做个记录

我们右击有错误提示的文件夹,如下:

The superclass "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 解决方法

我们再点击”添加库“,如下:

The superclass "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 解决方法

我们再点击”完成“,如下:

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path 解决方法

我们再点击”正常“,即可完成设置。这样我的错误就会消失了