Eclipse be like : “Cannot determine URI for [project-name]/[file-path]/[file-name]”

眉间皱痕 提交于 2021-02-18 22:08:47

问题


Main issue :

I've encountered the following error on Eclipse Luna :

You come one day at work and try to launch eclipse and be productive but as soon as your workbench opens you see that all your file tabs are in error like :

Cannot determine URI for 'my-project/path/to/file/filename.extension'

And if I check in my navigator/explorer views I see none of my projects.

The first couple times I did as recomended to other people who faced the same problem :

  • Eclipse Error: Cannot determine URI for /project-path/
  • Eclipse Luna "cannot determine URI for /project/src/com/.../classFile.java" (windows 8)

I re-created my projects under eclipse.


But :

  • the project has grown bigger (more and more sub-projects to re-create each time)
  • this problem is growing more and more frequent
  • I am growing weary of the manual work it requires

So I am not satisfied with the solution at hand.

Therefore I am looking for a some sort of way to fix this issue automatically (with come sort of script or set of command lines) or at least some way to prevent this from happening.


My progression so far :

I have delved into the workspace folder :

workspace
└── .metadata
    └── .plugins
        └── org.eclipse.core.resources
            └── .projects
                ├── project1-newName
                ├── project1-oldName
                ├── project2-newName
                └── project2-oldName

So my projects's metadas are still there !?

If I dig a bit further I see that each and every folder is organized as follows

.
├── .indexes
│   └── [...]
├── .location
├── .markers
├── org.eclipse.jdt.apt.core
└── org.eclipse.jdt.core
    └── state.dat

Where

  • .indexes contains a fat-mambo-jambo-of-split-index-tree-organization containing a history.index on each leaves
    • (does not seem that relevant to my issue)
  • .markers is empty
  • state.dat is empty
  • .location contains the string URI//file:/home/myname/projects/my/project/source/folder amidst some scramble chars like @��#%�磓

I'm pretty sure that the solution lies within this .location file.


Conclusion :

Has anyone any clue as to why eclipse can't suddenly read it's own files and How to make it see and recognise them again ?


回答1:


You can solve the problem by trying this:

  • Right click Package Explorer
  • Select Import
  • General > Existing Projects into Workspace > Navigate to the project
    folder(Select root directory)
    > select the Project.
  • Finish. This will certainly solve your problem.

If this doesn't work proceed to File System (General>FileSystem) and select the project files.

First method is quite easy and works perfectly in most cases.




回答2:


I faced the same issue. The above suggested method does not work in my case as Package Explorer -> Export option remains disabled. So I chose to create another workspace in Eclipse and followed the steps Import-> General -> Existing Projects into Workspace.

It worked fine after the Build Workspace was complete.



来源:https://stackoverflow.com/questions/30978065/eclipse-be-like-cannot-determine-uri-for-project-name-file-path-file-nam

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!