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

用Eclipse进行Java web开发时,出现这样的错误:The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path。Javaweb工程类中没有添加Tomcat运行时相关类导致。解决方法:

右击有错误提示的文件夹,点击”配置构建路径“,如下:

The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path_第1张图片

再点击”添加库“ Add Library,如下:


The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path_第2张图片

选中上图中标出的选项“Server Runtime”,再点击下一步,如下:


The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path_第3张图片

点击”完成“,如下:


The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path_第4张图片

你可能感兴趣的:(The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path)