Error:

    The import javax.servlet cannot be resolved

    The import javax.servlet.http.HttpServletRequest cannot be resolved

Description:

我们经常会把别人的项目copy到自己这里进行二次开发或者参考,有的时候会发生上面的错误,即eclipse项目里我们导入的项目里提示HttpServletRequest 不能引用,会伴随头疼的小红叉出现。

Accuse:

具体原因是我们工程里面web-inf/lib目录下少了相应的包:Package  javax.servlet.http引起的;通俗且确切的讲就是缺少TOMCAT_HOME\lib下的servlet-api.jar。

我导入别人的项目,在别人的机器上他配置了Server,一般都是tomcat,而在拷贝的过程中Server的那些library是不会随项目一起拷贝过来的,除非别人把tomcat的library已经拷贝到WEB-INF\lib下了。

解决方法:

    Project -> Properties -> Java Build Path -> Add Library -> Server Runtime -> next -> 选择你的Server -> Finish

刚开始用Myeclipse,把以前eclipse下的工程复制过来后,发现缺少Server Runtime。
本想直接在buildpath里加lib,在Myeclipse里找了一圈,恁是没发现在哪里可以添加,虽然在preference里enable了tomcat,但是add library选择WTP Server Runtime后的框里什么都没有空白。
解决方法如下:
      1,File->New->Other->Server->Apache->Tomcat v6.0 Server
注意在new时,别忘了先勾上Show All Wizards后有可能才能看到你要加的server。
     2,Project->Properties->Java Build Path->Libraries->Add Library->WTP Server Runtime(MyEclipse incompatible)->next->Tomcat v6.0 Server->Tomcat v6.0 Server

myeclipse10 java builder path libraries 添加tomcat的更多相关文章

  1. The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path(Myeclipse添加Server Library)

    网上找练习的项目导入到myeclipse项目发现每个JSP 出现错误The superclass "javax.servlet.http.HttpServlet" was not ...

  2. 如何解决JSP页面顶端报错 The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

    题目有点长,昨天刚接触jsp,按照网上的教程安装完 tomcat 和 eclipse EE 之后,新建jsp文件却出现了如下报错: The superclass "javax.servlet ...

  3. Eclipse下Java Build Path下Libraies中添加 Maven dependencies 失败解决方案

    当maven 仓库有jar时,tomcat生成时总是报javaclassno..........无这个文件:用一下方法 转载:http://bugyun.iteye.com/blog/2311848 ...

  4. Maven 梳理 - maven新建web项目提示"javax.servlet.http.HttpServlet" was not found on the Java Build Path

    方法一: <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api&l ...

  5. Java Web报错:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

    问题描述: 我们在用Eclipse进行Java web开发时,可能会出现这样的错误:The superclass javax.servlet.http.HttpServlet was not foun ...

  6. 新建 jsp异常,The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

    新项目,新建jsp页面的时候报异常: Multiple annotations found at this line: - The superclass "javax.servlet.htt ...

  7. build path libraries java基础--Jar包添加到build path方式说明--01

    摘自: http://blog.csdn.net/haolongabc/article/details/7007701 java基础--Jar包添加到build path方式说明--01 前言:这段短 ...

  8. 【问题解决:信息提示】SpringBoot启动时提示The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path

    问题描述 springboot程序在启动时提示信息 [2018-10-24 21:59:05.214] - 440 信息 [restartedMain] --- org.apache.catalina ...

  9. The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path 问题解决记录

    1.问题 启动Tomcat之后,在浏览器输入IP后显示503,查看catalina.log发现报错: 2.问题定位:缺少 tomcat-native library 就是说 缺少Tomcat Nati ...

随机推荐

  1. Vuejs之Component slot 插槽详解

    Vuejs的component的数据进行了沙箱隔离,除js全局变量如Math, Date之类外无法访问用户自定义的变量,所以使用component写组件或嵌套组件时明白变量的访问非常重要 编译作用域 ...

  2. maven 项目在 tomcat 中启动报错:Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)

    问题原因: 在下载 maven 依赖包的时候出现某种原因导致下载的依赖包出现损坏,jvm 和 maven 不能正常识别,从而导致出现该问题. 解决办法: 在 maven 仓库中搜索: in-progr ...

  3. CF629E Famil Door and Roads【树上计数+分类讨论】

    Online Judge:Codeforces629E,Luogu-CF629E Label:树上计数,分类讨论,换根 题目描述 给出一棵n个节点的树.有m个询问,每一个询问包含两个数a.b,我们可以 ...

  4. [Hdu-5155] Harry And Magic Box[思维题+容斥,计数Dp]

    Online Judge:Hdu5155 Label:思维题+容斥,计数Dp 题面: 题目描述 给定一个大小为\(N*M\)的神奇盒子,里面每行每列都至少有一个钻石,问可行的排列方案数.由于答案较大, ...

  5. Unity 用代码设置UGUI的渲染层级

    用代码设置UGUI渲染无非和三个API有关: 1.SetAsFirstSibling(); 2.SetAsLastSibling(); 3.SetSiblingIndex(n) SetAsFirstS ...

  6. 两队列模拟一个栈,python实现

    python实现两个队列模拟一个栈: class Queue(object): def __init__(self): self.stack1=[] self.stack2=[] def enqueu ...

  7. NOIP2018崩崩记

    比赛前,做做往年的题目,嗯,似乎都很水,400+绝对没问题,如果完全发挥,起码500+. 然而-- Day0 这天是运动会,信息学的同学们向老师请假来机房. 然后我在机房里刷往届的题目,信心倍增. 最 ...

  8. 初识css3 3d动画效果

    (先看我博客右上角的3d盒子动画效果,目前没做兼容处理,最好最新的chrome看)无意间看到网上css3写的3d动画效果,实在炫酷,以前理解为需要js去计算去写,没想到css直接可以实现.于是开始研究 ...

  9. jQuery5事件相关

    一.注册事件的方式 1.直接注册事件 $(this).事件名(动作函数)://$(this).click(fucntion(){//动作代码}); 2.bind同时给一个对象注册多个事件 $(this ...

  10. BZOJ 2165: 大楼

    Time Limit: 40 Sec Memory Limit: 259 MB Submit: 957 Solved: 353 [Submit][Status][Discuss] Descriptio ...