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. [COCI2019] Mobitel

    题目 显然不小于\(n\)这个东西我们不是很好搞,考虑正难则反,求出有多少条路径小于\(n\),之后拿\(C_{n+m}^m\)一减就好了 于是状态为\(dp[i][j][k]\)表示到\((i,j) ...

  2. netbeans 8.2 系统找不到指定的文件。

    系统找不到指定的文件.Using CATALINA_BASE: "C:\Users\wishr\AppData\Roaming\NetBeans\8.2\apache-tomcat-8.0. ...

  3. SpringData初探

    前言 项目中用到这个,没有学过,手动搭建,测试执行流程, 理论的东西有时间再补充 Maven依赖 <?xml version="1.0" encoding="UTF ...

  4. select2下拉内容获取后台数据

    controller(id给select:text给另外的input框) @RequestMapping(value = "findUnit")public @ResponseBo ...

  5. java基础之自定义单链表练习

    一.单链表 1.单链表是一种链式存取的数据结构,用一组地址任意的存储单元存放线性表中的数据元素.链表中的数据是以结点来表示的,每个结点的构成:元素(数据元素的映象) + 指针(指示后继元素存储位置), ...

  6. Visual studio 编译错误 无法将文件obj\Debug\*.exe复制到bin\Debug\*.exe

    问题: 错误 未能将“obj\Debug\Server.exe”复制到“bin\Debug\Server.exe”.超出了重试计数 10.失败. Server 错误 无法将文件“obj\Debug\S ...

  7. php静态变量问题

    <?php$a=0; function test(){ static $a=0; $a+=1; echo $a; }test(); test(); ?>1.static是与销毁时间有关,与 ...

  8. JS和vue中日期格式的转换

    1.获取当前时间: var now=new Date(); //Tue Oct 17 2017 18:08:40 GMT+0800 (中国标准时间) 获取当前时间的日期 new Date().getD ...

  9. ajax实例解析

    function showHint(str) { var xmlhttp; if (str.length==0) { document.getElementById("txtHint&quo ...

  10. Could not parse mapping document from resource com/hs/model/StudentModel.hbm.xml

    网上出现这个问题的 lei.hbm.xml配置写错的,文件头应该改为如下,并不是这个问题 <?xml version="1.0"?> <!DOCTYPE hibe ...