The declared package "com.XXX" does not match the expected package ""

出現這個問題時,在所選的目錄上新建包時,eclipse識別不出已經存在的包路徑,所以我認爲是eclipse找不到正確的包路徑問題。
出現問題的目錄結構,是我通過手工在window的資源管理器創建的.

我是按下面的方式解決的,將原有的目錄刪除,在eclipse中重新建包結構。

還找到一個相關的貼子,沒有實驗過。


One solution that worked for me when this error "The declared package does not match the expected package " occured for a project I checked-out from eclipse CVS :

1.Right click the project in the navigation bar and click 'delete'

2.Make sure 'Delete project contents on disk' option is NOT checked, and click OK.

3.Now after the project is deleted, go to File> Import> General> Existing Projects into Workspace

4.Select your workspace from the directory listing and check the box next to your project name. Click 'Finish'

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章