您的位置:首页 > 编程语言 > Java开发

java项目显示红叉,程序却没有错误

2017-08-28 10:00 405 查看
电脑换了不同版本的Tomcat和JDK后,导入之前的项目出现红叉错误,程序却没有出现错误:
在eclipse的markers标签页下提示2个错误警告:
错误一:Description
Resource Path Location Type Java compiler level does not match the version of the installed Java project facet. ******  Unknown  Faceted Project Problem (Java Version Mismatch)

本地资源描述文件中配置的jdk版本和我电脑上安装的版本不匹配。

解决方案:找到项目在本地工作空间目录下的  .settings目录。打开org.eclipse.wst.common.project.facet.core.xml
<
?xml version="1.0" encoding="UTF-8"?>

< ?faceted -project>

< ?runtime name="MyEclipse Tomcat v7.0">

< ?fixed facet="wst.jsdt.web">

< ?fixed facet="java">

< ?fixed facet="jst.web">

< ?installed facet="java" version="1.5">

< ?installed facet="jst.web" version="2.5">

< ?installed facet="jst.web.jstl" version="1.2">

< ?installed facet="web.struts2" version="2.1">

< ?installed facet="wst.jsdt.web" version="1.0">

< \/faceted>

< \/code>

将<
?installed facet="java" version="1.5">修改成自己电脑上安装的jdk版本,比如我安装的jdk是jdk1.8.0_91,就修改为


错误二:Description
Resource Path Location Type Target runtime MyEclipse Tomcat v7.0 Unknown Faceted Project Problem    本地安装的tomcat版本与项目资源配置文件配置的版本不匹配
解决方案:找到项目在本地工作空间目录下的  .settings目录。打开org.eclipse.wst.common.project.facet.core.xml
<
?xml version="1.0" encoding="UTF-8"?>

< ?faceted -project>

< ?runtime name="MyEclipse Tomcat v7.0">

< ?fixed facet="wst.jsdt.web">

< ?fixed facet="java">

< ?fixed facet="jst.web">

< ?installed facet="java" version="1.5">

< ?installed facet="jst.web" version="2.5">

< ?installed facet="jst.web.jstl" version="1.2">

< ?installed facet="web.struts2" version="2.1">

< ?installed facet="wst.jsdt.web" version="1.0">

< \/faceted>

< \/code>
将<
?runtime name="MyEclipse Tomcat v7.0">删除,保存后在eclipse中右键项目refresh.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: