eclipse java项目(包和类)中黄色感叹号(“!”)是什么原因?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26971315/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 22:13:06  来源:igfitidea点击:

What is reason for yellow exclamation mark ("!") in eclipse java project(package and classes)?

javaeclipseerror-handlingproject

提问by Maduri

Previously my project was in another machine. Then I added project into my new machine. After that I got error "error could not find or load main class". Then I remove JRE system library and again add. After that remove unused jar files and save the java build path. After that previous error removed and all code work finely. But every packages and classes from the beginning it shows yellow color exclamation mark. Doesn't give any error message. What is reason for that? How I remove it? Not red color. That's yellow color. (This happened to previouslyenter image description hereexist classes and packages. Not for newly creates classes)

以前我的项目在另一台机器上。然后我将项目添加到我的新机器中。之后我收到错误“错误无法找到或加载主类”。然后我删除 JRE 系统库并再次添加。之后删除未使用的 jar 文件并保存 java 构建路径。在删除之前的错误之后,所有代码都可以正常工作。但是每个包和类从一开始就显示黄色感叹号。不给出任何错误信息。这是什么原因?我如何删除它?不是红色。那是黄色。(这发生在以前在此处输入图片说明存在的类和包中。不适用于新创建的类)

![enter image description here][2]

![在此处输入图像描述][2]

回答by Pramod Karandikar

These exclamation marks are denoting warnings. This sign will appear on the packages which contains classes with warnings (like unused imports, unused variables, using raw types, etc.). You can reach the class containing warnings and have a look what's causing these warnings. Once found, depending on the warning, you can take necessary actions.

这些感叹号表示警告。此标志将出现在包含带有警告的类(如未使用的导入、未使用的变量、使用原始类型等)的包上。您可以访问包含警告的类并查看导致这些警告的原因。一旦找到,根据警告,您可以采取必要的措施。

回答by Sebri Zouhaier

In Eclipse, these are often caused by Java compiler warnings, and can also be caused by various validation warnings (for XML files, JSP files, etc.)

在 Eclipse 中,这些通常是由 Java 编译器警告引起的,也可能是由各种验证警告(对于 XML 文件、JSP 文件等)引起的。

To see the warning messages, go to Window => Show View => Problems.

要查看警告消息,请转到窗口 => 显示视图 => 问题。

This is a fairly comprehensive list from the Eclipse documentation. If anyone knows of another list — maybe with more details, or just the most common icons — feel free to add it.

这是来自 Eclipse 文档的相当全面的列表。如果有人知道另一个列表——也许有更多的细节,或者只是最常见的图标——随意添加它。

Juno: JDT Icons

朱诺:JDT 图标

Indigo: JDT Icons

靛蓝:JDT 图标

There are also some CDT icons at the bottom of this [help page][1].

在这个[帮助页面][1]的底部还有一些CDT图标。

If you're a Subversion user, the icons you're looking for may actually belong to Subclipse; see [this excellent answer]:What do the arrow icons in Subclipse mean?for more on those.

如果您是 Subversion 用户,您正在寻找的图标可能实际上属于 Subclipse;请参阅[这个优秀的答案]:Subclipse 中的箭头图标是什么意思?有关这些的更多信息。

http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.cdt.doc.user/reference/cdt_u_cproj_view.htm

http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.cdt.doc.user/reference/cdt_u_cproj_view.htm

回答by PDHide

Goto windows>showview>and select problems

转到 windows>showview> 并选择问题

enter image description here

在此处输入图片说明

This will show the details:

这将显示详细信息:

enter image description here

在此处输入图片说明