问题描述:  

  我们在用MyEclipse进行Java web开发时,可能会出现这样的错误:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path。我们该怎么解决这个问题呢?

  我遇到的错误显示如下:

  spring mvc学习(14) the superclass “javax.servlet.http.HttpServlet” was not found

回到顶部

问题原因:

  原来Javaweb工程类中没有添加 Tomcat运行时相关类 导致。

回到顶部

解决办法:

  下面是具体的解决方法:

  1、右击 web工程 --> 属性或Build Path --> Config Build Path... --> Java Build Path --> Libraries --> Add Library... --> MyEclipse Server Library --> Apache Tomcat v9.0

  spring mvc学习(14) the superclass “javax.servlet.http.HttpServlet” was not found

  spring mvc学习(14) the superclass “javax.servlet.http.HttpServlet” was not found

  spring mvc学习(14) the superclass “javax.servlet.http.HttpServlet” was not found

  spring mvc学习(14) the superclass “javax.servlet.http.HttpServlet” was not found

  2、切换到 Java Build Path 界面中的 Orader and Export,选择 Apache Tomcat v9.0[Apache Tomcat v9.0]

  spring mvc学习(14) the superclass “javax.servlet.http.HttpServlet” was not found

注意事项:

   按以上方法操作时,若打开 MyEclipse Server Library 后一片空白,需要设置 Apache Tomcat服务器

  设置方法为:Window --> Preferences --> Servers --> Runtime Environment --> Add... --> 选择Apache Tomcat 的版本后点 Next,再填入你Apache Tomcat服务器软件的安装(解压后)地址

相关文章: