java开发eclipse常见问题(一)The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

时间:2023-12-05 12:46:32

最近刚开始用Eclipse开发,刚开始都是按教程一步一步的新建web工程也没出现什么问题。

今天选了一个新的workspace,建了个web工程发现最简单的jsp页面都报错:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

java开发eclipse常见问题(一)The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

百度了下找到原因了,现在总结下,虽然是个简单的问题,但新手肯定会遇到过的。

报错原因是:web工程缺少编译Tomcat运行时相关类,只要加上就行了。

1、选择项目右击或 Build Path- Configure Build Path -Libraries- Add Libraries

java开发eclipse常见问题(一)The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

java开发eclipse常见问题(一)The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

2、在弹出框中选中Server Runtime—Next—Apache-Tomcatv7.0—Finish

java开发eclipse常见问题(一)The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

java开发eclipse常见问题(一)The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

3、再回到刚刚的窗口选择Order and Export—选中你刚刚添加的Apache-Tomcatv7.0

java开发eclipse常见问题(一)The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

4、重新打开页面,问题解决。

java开发eclipse常见问题(一)The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path