15

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:

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Darkphenom
  • 647
  • 2
  • 8
  • 14
  • The steps on that link are very specific. The question here is: to you have a library in your project that you're referencing but now you don't have to access to it? A jar that was only on Windows (or Linux) that you forgot to copy? – Luiggi Mendoza Oct 08 '12 at 14:47
  • Can we see the error log, as well as some source code (namely class decleration) and file name(s) – Azulflame Oct 08 '12 at 14:47
  • Got to your build path in eclipse as - `Right Click (Java Project) -> properties -> Java Build Path -> Libraries`. Do you see any jar/library being listed there and having `warning` or `issue` icon in front? – Yogendra Singh Oct 08 '12 at 14:51

9 Answers9

24
  1. Identify "project navigator" or "package explorer" view.
    Right click on your project, select Build Path --> Configure build Path.

  2. 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.

rj27
  • 89
  • 1
  • 9
Alfabravo
  • 7,493
  • 6
  • 46
  • 82
  • 3
    After step one, I deleted the library with a red 'x' beside it. I then added the default JRE library and then clicked ok. I refreshed the project and it worked. Thanks! – Darkphenom Oct 08 '12 at 15:34
  • When I attempt to open the build path editor, it tells me that there are "No options available" I have the test folder built, but it is not defined as a source folder. When I try to change it with R-click => Source => Format, nothing changes. – Python Cheese Sep 29 '16 at 14:30
2
  1. 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.

  2. 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.
Chetan Kinger
  • 15,069
  • 6
  • 45
  • 82
2

If you can't find the build path error, sometimes menu ProjectClean... works like a charm.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Christine
  • 5,617
  • 4
  • 38
  • 61
1

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Fabio Formosa
  • 904
  • 8
  • 27
  • Worked for me. We renamed project in pom.xml and since then it was showing red mark and some prerequisite not being built. Removing project metadata and re-importing project worked. Everything else didn't. – maverickm Nov 16 '18 at 05:33
0

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sohbati
  • 53
  • 6
0

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.

I tried all the previous given solutions, but they didn't work, but it works for me.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Vijay Bhatt
  • 1,351
  • 13
  • 13
0
  1. Right click your Project > Properties > Java Build Path > Libraries

  2. Remove the file with red "X" (something like JRE...)

  3. Add Library

That's how I solved my problem.

Pang
  • 9,564
  • 146
  • 81
  • 122
rodi
  • 1
0

In Eclipse, go to Build Path, click "Add Library", select JRE System Library, click "Next", select option "Workspace default JRE(i)", and click "Finish".

This worked for me.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Nages
  • 763
  • 1
  • 9
  • 12
0
  1. Go to Project > Properties > Java Compiler > Building
  2. Look under Build Path Problems
  3. Un-check "Abort build when build path error occurs"
    It won't solve all your errors but at least it will let you run your program :)
Hannah B
  • 109
  • 1
  • 9