Eclipse 中带有 mercurial 的红色感叹号
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3211381/
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
Red exclamation mark in Eclipse with mercurial
提问by stanga
I have imported a project with Mercurial (hg clone ...). When opening it with Eclipse, a red exclamation mark appears by the project's name in the Project Explorer, and it cannot be built. Silly messages like "import java.util cannot be resolved" appear, and errors in files are not marked in the Package Explorer.
我用 Mercurial (hg clone ...) 导入了一个项目。用Eclipse打开时,Project Explorer中项目名称旁边出现红色感叹号,无法构建。出现“import java.util无法解析”这样的傻信息,包资源管理器中没有标记文件中的错误。
How can I resolve this?
我该如何解决这个问题?
回答by nanda
Check the problem view. By exclamation it is usually means a problem with build path
检查问题视图。感叹号通常表示构建路径有问题
Check the Build Path of the project by right clicking the project and select Build Path -> Configure Build Path.
通过右键单击项目并选择 Build Path -> Configure Build Path 来检查项目的 Build Path。
One problem I often encountered is different people using different Java SDK and so when the exact SDK is not available in your machine, you need to change to your Java SDK (via JRE System Library -> Alternate JRE). A better way to avoid this problem is to always select the JRE System Library from Workspace default JRE or Execution Environment.
我经常遇到的一个问题是不同的人使用不同的 Java SDK,因此当您的机器上没有确切的 SDK 时,您需要更改为您的 Java SDK(通过 JRE 系统库 -> 备用 JRE)。避免此问题的更好方法是始终从 Workspace 默认 JRE 或执行环境中选择 JRE 系统库。
回答by John
I solved the problem by adding the external .jar file in to my project. RightClick on the project -> Properties -> Java Build path -> libraries tab -> Add jar
我通过将外部 .jar 文件添加到我的项目中解决了这个问题。右键单击项目 -> 属性 -> Java 构建路径 -> 库选项卡 -> 添加 jar
Select your jar file and added it
选择您的 jar 文件并添加它
Thats it the red ! mark gone.
那就是红色!标记不见了。
回答by Krishna Sinha
Some times it happens that you have added a jar file earlier but currently not using it. Then after some time you delete the jar file from your system. But since you are not using the library file, so you will not get any error.But then you will see the red exclamation mark for the project. So all you need is to remove the added jar from the Build Path.
有时,您之前添加了一个 jar 文件,但目前没有使用它。一段时间后,您从系统中删除 jar 文件。但是由于你没有使用库文件,所以你不会得到任何错误。但是你会看到项目的红色感叹号。所以你只需要从 Build Path 中删除添加的 jar。
Done.....
完毕.....
回答by Vincent Vettukal
It means there is a problem with the build path in your project. If it is an android project then it mostly means the target value specified in project.properties file cannot be found. This can also be caused because of other kinds of built problems. But it is shown mostly for built problems only. See herefor more details. It is about built error decorater seen in eclipse.
这意味着您的项目中的构建路径存在问题。如果它是一个android项目,那么它主要意味着找不到project.properties文件中指定的目标值。这也可能是由于其他类型的内置问题引起的。但它主要仅针对已构建的问题显示。请参阅此处了解更多详情。它是关于在 eclipse 中看到的内置错误装饰器。
An extract from that page:
该页面的摘录:
Build path problems are sometimes easy to miss among other problems in a project. The Package Explorer and Project Explorer views now show a new decorator on Java projects and working sets that contain build path errors:
在项目中的其他问题中,有时很容易遗漏构建路径问题。Package Explorer 和 Project Explorer 视图现在在包含构建路径错误的 Java 项目和工作集上显示一个新的装饰器:
The concrete errors can be seen in the Problems view, and if you open the view menu and select Group By > Java Problem Type, they all show up in the Build Path category:
具体的错误可以在 Problems 视图中看到,如果你打开视图菜单并选择 Group By > Java Problem Type,它们都会显示在 Build Path 类别中:
回答by stanga
The Java Runtime Library was defined wrong for the pulled project.
Java 运行时库为拉取的项目定义错误。
It had to be reset under Project | Properties | Java Build Path | Libraries.
它必须在 Project | 下重新设置 属性 | Java 构建路径 | 图书馆。
回答by Francis Gauthier
I figured out each time i am trying to import a library into my android project, i have a red exclamation mark with both ActionBarSherlock and Facebook libraries
我发现每次尝试将库导入我的 android 项目时,ActionBarSherlock 和 Facebook 库都有一个红色感叹号
This is how i solved it:
我是这样解决的:
After adding the library into your project "project properties->Android->Librairy->add"
将库添加到您的项目后“项目属性->Android->库->添加”
If you are using Eclipse, all you have to do is to clean your project and build all your workspace:
如果您使用的是 Eclipse,您所要做的就是清理您的项目并构建您的所有工作区:
"project -> clean... -> "clean selected project" -> build the entire workspace
“项目->清理...->“清理选定的项目”->构建整个工作区
回答by shubhamsingh147
This is how I solved this problem:- Right-Click to project->properties->Java Build Path->Libraries(tab)->Remove the Jar which is already present there with a Path given along.
这就是我解决这个问题的方法:- 右键单击项目-> 属性-> Java 构建路径-> 库(选项卡)-> 删除已经存在的 Jar,并附带一个路径。
回答by brandall
For me, the problem was a simple one - the reference project was compiled in 1.5 and my project 1.6. Matching the two solved the issue.
对我来说,问题很简单——参考项目是在 1.5 中编译的,而我的项目是 1.6。两者匹配解决了这个问题。
Right-hand-click on the project, select properties, select java compiler.
右键单击项目,选择属性,选择java编译器。