博主头像
Wood Chen

万事如意

  • 累计撰写 284 篇文章
  • 累计创建 238 个标签
  • 累计收到 20 条评论

目 录CONTENT

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

2021-09-06 · 0 评论 · 0 点赞 · 64 阅读 · 0 字

原因:在 java web 工程下没有引入中间件(服务器 tomcat)运行的 library,一般只有动态网页工程才有这个报错

解决办法:

(1): 确认 eclipse 中 server 的运行环境是否有配置,设置方法为:Window → Preferences → Server → Runtime Environments →Add → 选择 Apache 的版本后点 Next,再填入你 apache tomcat 软件的安装(解压后)目录。

(2): 右击 web 工程 → Build Path → Configure build path... → Java Build Path → Libraries → Add Libray... → Server Runtime →Next> → Apache Tomcat Server →Finish。

(3): 切换到 Java Build Path 界面中的 Orader and Export,勾选 Tomcat。

(4): 右击 web 工程 → 属性 → Project Facets → 点击右侧 tab 选择 Runtimes → 勾选 tomcat → OK。

评论区