解决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

  • 问题原因:原来Javaweb工程类中没有添加 Tomcat运行时相关类导致。

方法一

我们右击有错误提示的文件夹,点击”配置构建路径“,如下图:
解决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
选中上图中标出的选项,再点击下一步,如下图:
解决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
如果问题还没解决,参考方法二

方法二

添加jar包,如图:
解决Eclipse报错:The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path
OK,问题就解决了!