Myeclipse的动态web项目转为eclipse的动态web项目报错

在Myeclipse中重新定义了web服务了目录的文件夹,而这些,都定义在.classpath文件下

删除Myeclipse的javaee容器标签,如下,这一句不改会报找不到的错误。

如下:

 
 
Description Resource Path Location Type
Classpath entry melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_5_CONTAINER will not be exported or published.
Runtime ClassNotFoundExceptions may result.
orderdinner P/orderdinner Classpath Dependency Validator Message
删除下面这一句
删除classpath文件里面的
< classpathentry   kind = "con"   path = "melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_5_CONTAINER" />   
然后在eclipse中导入这个工程,可能会出现以下错误
   
   
Description Resource Path Location Type
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path addfood.jsp
/orderdinner/WebRoot/admin line 1 JSP Problem
servlet相关的类找不到

点击项目名--右键-->Build Path-->Configure Build Path

选择Library,点击Add Library,选择Server Runtime点击Next,选择你配置的服务器,比如说Tomcat点击Finish,点击OK

然后配置以下运行时要用到的服务器

最后映射关系可能会出现问题点击Properties-->Project Facets

勾选Dynamic Web Module,右边的运行时注意选上tomcat

点击下边的Futher configuration available

Content directory改成WebRoot点击Apply点击OK

配置成功!

对比以下Myeclipse和eclipse的.classpath文件吧

myeclipse的文件

     
     
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_5_CONTAINER"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-fileupload-1.2.1.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-io-1.4.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jstl.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mysql-connector-java-5.0.8-bin.jar"/>
<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/standard.jar"/>
<classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
</classpath>

eclipse的文件
     
     
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<span style="white-space:pre"> </span><classpathentry kind="src" path="src"/>
<span style="white-space:pre"> </span><classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-fileupload-1.2.1.jar"/>
<span style="white-space:pre"> </span><classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-io-1.4.jar"/>
<span style="white-space:pre"> </span><classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jstl.jar"/>
<span style="white-space:pre"> </span><classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mysql-connector-java-5.0.8-bin.jar"/>
<span style="white-space:pre"> </span><classpathentry kind="lib" path="WebRoot/WEB-INF/lib/standard.jar"/>
<span style="white-space:pre"> </span><classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0">
<span style="white-space:pre"> </span><attributes>
<span style="white-space:pre"> </span><attribute name="owner.project.facets" value="jst.web;#system#"/>
<span style="white-space:pre"> </span></attributes>
<span style="white-space:pre"> </span></classpathentry>
<span style="white-space:pre"> </span><classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre7">
<span style="white-space:pre"> </span><attributes>
<span style="white-space:pre"> </span><attribute name="owner.project.facets" value="java"/>
<span style="white-space:pre"> </span></attributes>
<span style="white-space:pre"> </span></classpathentry>
<span style="white-space:pre"> </span><classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<span style="white-space:pre"> </span><classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<span style="white-space:pre"> </span><classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
</classpath>

此外,还有另一种改法,也是比较常见的,在eclipse下新建动态Web 项目,然后复制src下的文件到src目录,复制WebRoot目录下的文件WebContent目录下

对应的.classpath文件为


     
     
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>


详细请看:http://blog.csdn.net/gsls200808/article/details/40710357;



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值