2010-01-15 109 views
2

我使用基于Eclipse 3.x构建的WID 6.1。Eclipse“元素创建失败”

当试图右键单击一个文件夹,新建 - >类,键入类的名称,然后单击Finish,我得到的错误

“元素的创建失败。 org.xml.sax中的.SAXParseException: 文件过早结束。“

昨天发生这种情况时,我重新创建了我的工作空间,但现在又发生了。重新安装WID是两到三个小时的任务,所以我更愿意修复实际问题。

对此提出建议?

编辑: WID的第二次重新启动后,我现在得到“错误初始化Java工具。”,这是原来的错误消息我得到更多的搜索。

编辑:看在WID/Eclipse日志中,有一个例外,但它不告诉我哪个项目或哪个文件。

Caused by: org.xml.sax.SAXParseException: Premature end of file. 
    at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) 
    at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source) 
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) 
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) 
    at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source) 
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) 
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) 
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) 
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) 
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) 
    at javax.xml.parsers.DocumentBuilder.parse(Unknown Source) 
    at org.eclipse.wst.common.internal.emf.utilities.DOMUtilities.loadDocument(Unknown Source) 
    ... 21 more 

回答

2

点击窗口,显示视图,错误日志。

从工作区中删除所有项目。

将项目逐个重新加载到工作区中,查看错误日志。

对于导致加载错误的项目,进入他们的.settings文件夹,看到那些文件有空白和/或0字节。删除了所有这些,并再次运作。