[英]How can I get Eclipse to underline in red the imports which don't exist?
I recently switched IDE's to Eclipse. 我最近将IDE切换到Eclipse。 Just to test that I am not insane, I added something like
为了测试我不是疯了,我添加了类似
import x;
to the top of the Java file. 到Java文件的顶部。 I was expecting to see the red squiggly line underlining the library the IDE can't find, but it didn't do it automatically.
我期望看到红色的波浪线突出显示了IDE找不到的库,但这不是自动执行的。
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? 如何设置Eclipse设置以告诉我某些语法是否错误,或者我要导入的库不在位?
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.
Eclipse偶尔会丢失自动重建的轨道。
Unresolvable imports are a compiler error, not something you configure in Eclipse. 无法解决的导入是编译器错误,而不是您在Eclipse中配置的错误。
Make sure the file is located under a Java source directory: 确保文件位于Java源目录下:
Project > Properties > Java Build Path > Source tab
Also verify that Project > Build Automatically
is enabled. 还要确认已启用“
Project > Build Automatically
。 You may need to do a Project > Clean
to jump start automatic builds. 您可能需要执行“
Project > Clean
才能开始自动构建。
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.