Linux Eclipse 中的错误:“在解决构建路径错误之前无法构建项目”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12784078/
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
Error in Eclipse: "The project cannot be built until build path errors are resolved"
提问by Darkphenom
I am a computer science student learning Java, so I do some work at home and at college on a mixture of Linux and Windows. I have a problem after copying a new project into the Eclipse workspace. The project shows up, but with a red exclamation mark and an error saying:
我是一名学习 Java 的计算机科学专业的学生,所以我在家里和大学里做一些 Linux 和 Windows 混合的工作。将新项目复制到 Eclipse 工作区后出现问题。项目出现了,但有一个红色的感叹号和一个错误说:
The project cannot be built until build path errors are resolved
在解决构建路径错误之前无法构建项目
How can I fix this? I tried the solution described here, but it didn't work.
我怎样才能解决这个问题?我尝试了此处描述的解决方案,但没有奏效。
采纳答案by Alfabravo
Identify
"project navigator"
or"package explorer"
view.
Right click on your project, selectBuild Path --> Configure build Path
.In the emerging window, you will find four tabs, select
"Libraries"
.There, under"Web app libraries"
(expand it), you will see the libraries added to the project's classpath. Check if all of them are available. If one or more are not (they'll have "missing" beside their name and a red mark on their icon), check if you need them (perhaps you don't); if you don't need them, remove it, if you need them, exit this window, look out for the missing jar and IMPORT it into your project.
识别
"project navigator"
或"package explorer"
查看。
右键单击您的项目,选择Build Path --> Configure build Path
。在出现的窗口中,您将找到四个选项卡,选择
"Libraries"
。在"Web app libraries"
那里,在(展开它)下,您将看到添加到项目类路径中的库。检查是否所有这些都可用。如果一个或多个不是(他们的名字旁边会有“失踪”,并且他们的图标上会有一个红色标记),请检查您是否需要它们(也许您不需要);如果您不需要它们,请将其删除,如果需要,请退出此窗口,查找丢失的 jar 并将其导入到您的项目中。
回答by CKing
Open the Problems view. You can open this view by clicking on the small + sign at the left hand bottom corner of eclipse. It's a very tiny plus with a rectangle around it. Click on it and select problems.
The problem view will show you the problems that need to be resolved.
- If the message says "the project is missing the required libraries...", you need to configure your build path by right clicking on your project, selecting properties, then build path. Add the required jar files using the libraries tab. -If there are other problems other than missing libraries, you need to post the exact problems here to get a precise solution.
打开问题视图。您可以通过单击 eclipse 左下角的小 + 号打开此视图。这是一个非常小的加号,周围有一个矩形。单击它并选择问题。
问题视图将显示需要解决的问题。
- 如果消息显示“项目缺少所需的库...”,则需要通过右键单击项目,选择属性,然后构建路径来配置构建路径。使用库选项卡添加所需的 jar 文件。- 如果除了缺少库之外还有其他问题,您需要在此处发布确切的问题以获得精确的解决方案。
回答by Sohbati
I also had this problem in my system, but after looking inside the project I saw the XML structure of the .classpath file in the project path was incorrect. After amending that file the problem was solved.
我的系统中也有这个问题,但在查看项目内部后,我看到项目路径中 .classpath 文件的 XML 结构不正确。修改那个文件后问题就解决了。
回答by Vijay Bhatt
If not working in any case...then delete your project from the Eclipse workspace and again import as a Maven project if that is a Maven project. Else import as an existing project.
如果在任何情况下都不起作用...然后从 Eclipse 工作区中删除您的项目,如果它是一个 Maven 项目,则再次作为 Maven 项目导入。否则作为现有项目导入。
I tried all the previous given solutions, but they didn't work, but it works for me.
我尝试了之前给出的所有解决方案,但它们不起作用,但它对我有用。
回答by Christine
If you can't find the build path error, sometimes menu Project→ Clean...works like a charm.
如果您找不到构建路径错误,有时菜单Project→ Clean...就像一个魅力。
回答by rodi
Right click your Project > Properties > Java Build Path > Libraries
Remove the file with red "X" (something like JRE...)
Add Library
右键单击您的项目 > 属性 > Java 构建路径 > 库
删除带有红色“X”的文件(类似于 JRE...)
添加库
That's how I solved my problem.
这就是我解决我的问题的方法。
回答by Nages
In Eclipse, go to Build Path, click "Add Library", select JRE System Library, click "Next", select option "Workspace default JRE(i)", and click "Finish".
在 Eclipse 中,转到 Build Path,单击“Add Library”,选择 JRE System Library,单击“Next”,选择选项“Workspace default JRE(i)”,然后单击“Finish”。
This worked for me.
这对我有用。
回答by Fabio Formosa
In my case, all libraries in the build path were OK.
就我而言,构建路径中的所有库都正常。
To solve it, I deleted all project metadata (.project, .classpath, .settings) and re-imported the project as a Maven project.
为了解决这个问题,我删除了所有项目元数据(.project、.classpath、.settings)并将项目重新导入为 Maven 项目。