java.servlet.http.httpservlet was not found on the Java Build Path

问题描述:我在创建web jsp后,出现了java.servlet.http.httpservlet was not found on the Java Build Path错误异常……之前因为乱码问题乱改一通,网上搜了好多教程也没解决,还误删了tomatch导致出现这种报错……


原因分析:在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。
参考博客:
https://blog.csdn.net/dietime1943/article/details/75127417

猜你喜欢

转载自www.cnblogs.com/lyqf/p/10706711.html