简体   繁体   中英

Eclipse imports inexplicably not resolved

I'm having a rather mysterious error:

All of my imports have been redlined with the message "the import cannot be resolved". However, the types referenced by those same imports are also redlined, and the auto fix suggests adding those exact imports.

http://i.imgur.com/GRJoP6P.png

http://i.imgur.com/uBmrTHm.png

The imports in question are from another project in my workspace, and that project is definitely in this project's workspace.

Does anybody know what the hell is going on here?

EDIT: I got the issue to go away by removing the project from the build path, copying it, deleting it, then pasting it back into the workspace and re-adding it to the build path. I'd still like to know if anybody knows what the heck happened though.

This happens sometimes when your buildpath loses its reference to your JRE. You can fix this by re-adding the JRE System Library to your buildpath. It is an interesting bug in Eclipse that I'm not sure why it happens.

The other option is to start new project and copy everything over, but this is tedious and annoying as it looks you have already discovered.

Sometimes it problems occurs when you are using maven and maven delete all .classes, one solution is clean your project

In eclipse menu bar: Project > clean

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM