开发者

How can I get Eclipse to underline in red the imports which don't exist?

I recently switched IDE's to Eclipse. Just to test that I am not insane, I added something like

import x;

to the top of the Java file. I was e开发者_JAVA技巧xpecting to see the red squiggly line underlining the library the IDE can't find, but it didn't do it automatically.

How can I set the Eclipse setting to tell me if some syntax is wrong, or a library I am importing isn't in place?


It should flag it as a compiler error automatically (including the squiggly line). You might need to convince it to rebuild the project. Are you automatically building the project, or doing it manually? Eclipse occasionally loses track of automatic rebuilds.


Unresolvable imports are a compiler error, not something you configure in Eclipse.

Make sure the file is located under a Java source directory:

Project > Properties > Java Build Path > Source tab

Also verify that Project > Build Automatically is enabled. You may need to do a Project > Clean to jump start automatic builds.


I can change mine in the following preferences.

Window->Preferences
General->Editors->Text Editors->Annotations
Annotation types->Errors

Check the box: Text as
Select: Native Problem Underline as the drop down
Choose a color
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜