Multiple annotations found at this line: - The superclass "javax.servlet.http.HttpServlet" was not
第一次在eclipse中导入一个Javaweb probject,一般会出现下边的错误,这是因为没有配置jre环境的问题。
1、鼠标右击出错的项目,点击Build path-->Configure Build path
2、然后出现下边的页面,默认是定位在Order and Export标签所在的页面的,我们点击Libraies
3、可以看到出错的原因是Jre系统库的问题,点击出错的地方发现是需要设置相关的jre环境
4、我们只需要将自己机器上安装的jre配置到这里即可,我用的是1.8.0的版本,大家可以根据自己的需要下载jre就可以
5、配置好之后点击finish,会发现错误已经没有了,然后点击ok,这时项目中的错误就不存在了。或许有的人还会存在The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path错误,这是因为没有配置Tomcat的原因
6、仍然是右击项目,选择Build Path-->Configure Build Path
7、点击Add Libraies-->Server Runtime-->next
8、如果你发现点击下一步之后的页面是空的,这是因为你还没有为server配置tomcat
9、点击控制台下边的servers,右键new->Server
10、在弹出的页面选择Apache,然后选择你需要的tomcat版本,当然前提是你的机器上安装了tomcat
11、然后next,选择你的tomcat所在的目录,同时注意jre是不是你安装的jre,不是的话建议修改一下
12、next,将你需要部署的项目添加到这个server下,也可以忽略这个步骤,后边需要的时候在部署,现在直接finish
然后重复步骤6-8,这是进行到第8步所说的页面会出现下边的页面,直接点击finish即可