本文翻译自:The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path [duplicate]

This question already has an answer here: 这个问题在这里已有答案:

  • How do I import the javax.servlet API in my Eclipse project? 如何在Eclipse项目中导入javax.servlet API? 15 answers 15个答案

I have a project created by Maven integration in Eclipse. 我有一个由Eclipse中的Maven集成创建的项目。 All work fine, but in the work space in all JSP files have this: 一切正常,但在所有JSP文件的工作空间中都有这样的:

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

To the first string where place: 到第一个字符串所在的位置:

<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>

When I create a basic dynamic web project and JSP in - all is fine, no errors. 当我创建一个基本的动态Web项目和JSP时 - 一切都很好,没有错误。


#1楼

参考:https://stackoom.com/question/1XTuj/在Java-Build-Path中找不到超类-javax-servlet-http-HttpServlet-重复


#2楼

Include servlet-api-3.1.jar in your dependencies. 在依赖servlet-api-3.1.jar中包含servlet-api-3.1.jar

  • Maven Maven的

     <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> <scope>provided</scope> </dependency> 
  • Gradle 摇篮

     configurations { provided } sourceSets { main { compileClasspath += configurations.provided } } dependencies { provided 'javax.servlet:javax.servlet-api:3.1.0' } 

#3楼

Select project → PropertiesProject FacetsTarget RuntimesVMware Server . 选择项目→ 属性项目构面目标运行时VMware服务器

It worked for me. 它对我有用。


#4楼

Project → PropertiesTarget RuntimesApache Tomcat worked for me. 项目→ 属性目标运行时Apache Tomcat为我工作。 There is no Target Runtimes under Facets (I'm on Eclipse v4.2 (Juno)). Facets下没有Target Runtimes(我在Eclipse v4.2 (Juno)上)。


#5楼

As this is unanswered, I am guessing something other than Maven dependencies are wrong with the ops build. 由于这是没有答案的,我猜测除了Maven依赖项之外的其他东西是ops构建错误的。

While not using Maven, I have the same problem from time to time when re-creating my development environment from svn, and I always forget why and have to figure it out. 虽然不使用Maven,但是当我从svn重新创建我的开发环境时,我经常会遇到同样的问题,而且我总是忘记原因并且必须弄明白。 Unfortunately it seems this is a problem with Eclipse. 不幸的是,这似乎是Eclipse的一个问题。

I am able to remove all such errors from once working projects by picking just one of the dynamic web projects, or just tomcat dependent projects, and move a dependency in the build order. 我可以通过选择一个动态Web项目或仅仅依赖于tomcat的项目从一次工作项目中删除所有此类错误,并在构建顺序中移动依赖项。 This seems to force all projects to rebuild properly and all of the errors are then resolved. 这似乎迫使所有项目正确重建,然后解决所有错误。

Right click on a web project, select "build Path" -> "Configure Build Path". 右键单击Web项目,选择“构建路径” - >“配置构建路径”。 Go to the tab "Order and Export", then pick a library or jar entry and move it up or down. 转到“订购和导出”选项卡,然后选择库或罐子条目并向上或向下移动。 I used the JRE System Library and moved it to the top. 我使用了JRE系统库并将其移到了顶部。

Click OK, and all that red goes away! 单击确定,所有红色消失!


#6楼

如果您没有使用Maven,只需将javax.servlet-api.jar放在项目lib文件夹中即可。

在Java Build Path中找不到超类“javax.servlet.http.HttpServlet”[重复]相关推荐

  1. 在java.library.path中找不到允许在生产环境中实现最佳性能的基于APR的Apache Tom.....

    在java.library.path中找不到允许在生产环境中实现最佳性能的基于APR的Apache Tom- 2021-6-2 19:55:17 org.apache.catalina.core.Ap ...

  2. Web项目:解决eclipse中jsp文件报错javax.servlet.http.HttpServlet 提示 was not found on the Java Build Path的错误

    具体错误如图示如下: 具体结局方案如下: 1.右击web工程(你的项目名字)->属性或Build Path->Java Build Path->Libraries-> Add ...

  3. 解决Eclipse java build path中Web App Libraries无法自动找到WEB-INF的lib目录

    昨天提交代码的时候自己的eclipse抽风了一下,导致CVS插件也挂掉了,总是刷不出CVS目录列表.然后发现自己的Web App Libraries里面的Jar包全部都不会自动加入到Web App L ...

  4. java 依赖的项目报错_关于eclipse的maven项目Java Build Path中maven依赖报错问题

    android之AutoCompleteTextView控件用法 c#汉字转为拼音 using System; using System.Collections.Generic; using Syst ...

  5. Eclipse Java Build Path详解

    Eclipse Java Build Path详解 1.设置"source folder"与"output folder". * source folder:存 ...

  6. eclipse中出现The superclass “jakarta.servlet.http.HttpServlet“ was not found on the Java Build Path

    遇到的问题 在Eclipse的Web项目中的readme.jsp文件显示错误:The superclass "jakarta.servlet.http.HttpServlet" w ...

  7. 用Eclipse开发JavaWeb项目:错误信息 javax.servlet.http.HttpServlet was not found on the Java Build Path...

    1.错误描述:JSP页面顶端出现"红色"的报错信息:The superclass "javax.servlet.http.HttpServlet" was no ...

  8. JavaWeb: 报错信息The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path...

    JavaWeb: 报错信息The superclass "javax.servlet.http.HttpServlet" was not found on the Java Bui ...

  9. Eclipse新建web项目和“javax.servlet.http.HttpServlet“ was not found on the Java Build Path错误

    Eclipse新建web项目:当前Eclipse中Tomcat已经配置好: 输入项目名称:完成: 新建的web项目目录结构如下: 右击Webcontent文件夹,新建一个JSP文件: 输入JSP文件名 ...

最新文章

  1. 苏宁V购 不为拯救 只求改变
  2. 【错误记录】VMware 虚拟机报错 ( 向 VMWare 虚拟机中的 Ubuntu 系统拷贝文件时磁盘空间不足 ② | 删除交换空间 )
  3. python中二维列表的遍历方式(亲测)
  4. 读书笔记7-浪潮之巅(part2)
  5. php 数组 组成新数组,PHP让数组中相同值的组组成新的数组详解
  6. (winform)在一个form里面显示google地图
  7. 3011-基于二叉树的表达式求值(C++,附详细思路)
  8. android学习十三(android的通知使用)
  9. jQuery 图片滚动 Carousel Lite 使用说明
  10. mybatis-plus 官方发布神器,一个依赖轻松搞定数据权限,再也不用自己实现了!...
  11. 电脑主板原理图讲解(电脑主板构造图文详解)CPU和北桥芯片(随着发展有的北桥已经被设计到CPU内部了)南桥芯片
  12. Proteus —— 电路仿真软件
  13. 英语计算机四级如何查询,四级成绩查询
  14. Nebula Graph - 全文索引
  15. 阿尔伯塔大学知名计算机工程学教授,阿尔伯塔大学计算机工程硕士解析
  16. 管理:49个终身受用的职场“顶级思维”!
  17. 需求预测——Gallat: A Spatiotemporal Graph Attention Network for Passenger Demand Prediction
  18. 前端常识:常见显示器屏幕分辨率
  19. 【c语言】数字金字塔
  20. bios设置使用集成显卡输出视频信号后,显示器黑屏了

热门文章

  1. Activity管理(二):adj内存管理机制
  2. StaticLayout的介绍/使用
  3. 转: Meshlab简介
  4. 第五周项目二-游戏中的角色类(2)
  5. 小程序开发填坑汇总贴
  6. php消费rabbitmq消息QoS,简介Rabbitmq的几种消费模式
  7. python外星人入侵游戏图片_跪求一个问题@关于外星人入侵游戏(《python编程基础从入门到实...
  8. C语言函数集(十七)
  9. Spark读取Parquet格式的数据为Dataframe
  10. Android 之小技巧