首页 > 代码库 > 新建web工程报错:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

新建web工程报错:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

解决方法一:找到tomcat安装路径,在tomcat根目录下的lib文件夹里,有一个servlet-api.jar,将这个jar包导入到项目中即可;

解决方法二:(1)右击web工程->属性或Build Path->Java Build Path -> Libraries -> Add Library... ->Server Runtime -> Tomcat Server

        (2)切换到Java Build Path界面中的Orader and Export,选择Tomcat。
 
注意:按以上方法操作室,若打开Server Runtime 后一篇空白,需要设置Apache服务器。
步骤:Window->Preferences ->Server ->Runtime->Environment->add->选择Apache的版本后点next,再填入你的Apache服务器软件的安装地址。

新建web工程报错:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path