2010-01-15 283 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字節。刪除了所有這些,並再次運作。