41

I'm using Eclipse for Java Develepers (Juno x64 running on Windows 7).

I have a project in which I was trying out a jar I no longer need (args4j), so have removed the dependency. At some point, my PC lost power unexpectedly, and I've since restarted Eclipse.

My project now has an error, "Project 'MyProject' is missing required library: '/path/to/args4j-2.0.21.jar'". I was working with the project for some time after removing the dependency without any issues.

Under the Project Properties > Java Build Path, there's no reference to args4j in any of the tabs.

I've tried:

  • searching for the string "args4j" in all files within my project, but there are no matches. There are a bunch of references within <workspace>\.metadata\.plugins\org.eclipse.core.resources\.history\, but I'm reticent to touch them out of fear I might break something else.
  • [Edit] clean rebuild has no effect.

Does anyone have any idea why Eclipse is complaining, and what I might be able to do to fix it?

Martin
  • 3,703
  • 2
  • 21
  • 43
  • Did you try the usual clean/build? More often than not Eclipse will highlight the source files in error and will give you more info in Problems tab too – Germann Arlington Sep 27 '12 at 11:23
  • Yeah, I knew I missed something in my description of what I'd tried. I've tried a clean rebuild, with no success. – Martin Sep 27 '12 at 11:36

5 Answers5

79

Please do the following, if one does not solve your problem, skip to the next one:

  1. Check .classpath file in your project folder. You might have a reference there.
  2. Close and re-open the project without closing eclipse, this might rebuild Eclipse resource cache.
  3. Make a clean build after re-opening.
  4. Re-import your project into a clean workspace.
Hakan Dilek
  • 2,178
  • 2
  • 23
  • 35
  • Nope. No reference to the library anywhere within the project hierarchy. Restarting Eclipse gives the same result. – Martin Sep 27 '12 at 11:36
  • 2
    please try closing and reopening the project, without restarting eclipse. this might trigger a rebuild of eclipse resources. – Hakan Dilek Sep 27 '12 at 12:06
  • you can also try importing your project into a clean workspace. – Hakan Dilek Sep 27 '12 at 12:06
  • 1
    Whoah, completely misread your suggestion as "try re-importing the library". It was re-importing the library that worked. Will edit your answer. – Martin Sep 27 '12 at 12:14
  • Great! I've reedited my solution. Good luck with your project. – Hakan Dilek Sep 27 '12 at 18:08
  • 2
    It was re-adding and removing the problem jar that did it for me (which saved re-configuring my workspace, which would be a pain). Marking you as correct answer because even though you didn't say it, you got me going in the right direction. – Martin Sep 28 '12 at 00:43
  • Tried editing your answer again to provide the actual soltion. It got rejected. Will post my own answer. – Martin Sep 28 '12 at 01:09
  • I think re-editing needs more reputation. I can not approve your edit as well. If you like, I can add your solution as the 3rd step in my answer. – Hakan Dilek Sep 28 '12 at 07:10
  • +1 for suggestion number 2 (reopen the project). I didn't have a reference in my .classpath, but this worked for me. – José Ramón Sep 05 '13 at 08:38
  • 2
    Thanks #2 worked for me (and I've been having this issue for awhile). I had to do a clean build after re-opening the project to resolve related issues. – wbdarby Nov 30 '15 at 15:32
  • 1
    Removing the references from .classpath worked for me. Thanks a bunch. – Dinesh Kumar Jan 17 '17 at 10:23
  • 1
    #2 close and reopen the project, then clean also work for me – user1169587 Nov 05 '21 at 10:05
12

Re-adding the problematic jar, then removing it did the trick. This is better than reconfiguring the entire workspace in my case, as I have many projects, and ADT configuration in my workspace.

Martin
  • 3,703
  • 2
  • 21
  • 43
  • Hakan Dilek's answer (item 3) did it for me with a similar problem. But it is surely more effort than your solution which I did not even see... – lukas.coenig Apr 16 '15 at 13:34
  • Btw. noone answered the implicit question of why eclipse does this. I had no power loss or anything, just restarted eclipse (LUNA) after removing the library. So, this (still) seems to be a (known?) bug. – lukas.coenig Apr 16 '15 at 13:40
  • I concur that this might be a subtle bug, perhaps in Luna. I ran into this over the weekend with an admin forced restart with Eclipse open. –  Dec 21 '15 at 14:43
6

I've found that the easiest and simplest way is to switch to the navigator view, open the .factorypath file and delete the offending dependency.

Michael Wiles
  • 20,902
  • 18
  • 71
  • 101
4

Deleting .classpath and .project, then reimporting the project as a Maven Project did work for me. It may also be useful to mark all Eclipse workfiles like .classpath in the p4ignore or gitignore from the beginning at the initial commit.

Brain
  • 447
  • 7
  • 21
1

DO - mvn eclipse:clean eclipse:eclipse, on project and then refresh and then clean project , will solve this problem

Derrick
  • 3,669
  • 5
  • 35
  • 50
annu
  • 103
  • 2
  • 10