GhostCat
GhostCat

Reputation: 140457

Project is missing required library - but correct JAR exists?

One of my eclipse projects gives me the Project X is missing required library: 'somelib.jar' error, but when I go to Configure Build Path > Libraries the library is present, and no error is indicated there.

I tried the usual things:

My coworkers, using the same git checkout with the same status as mine, and also using eclipse Neon2, have no build errors.

Just to be sure, I navigated into the corresponding directory and removed a different jar file, and when I look at my build path configuration that jar shows up with a red "x" indicating that the library is missing.

I checked that somelib.jar sits in the expected place and is a valid JAR file.

How do I fix this?

Upvotes: 5

Views: 16881

Answers (3)

lubrum
lubrum

Reputation: 444

If you have multiple projects opened in such way that one depends on another, and the problematic project depends on others, refreshing all dependent projects will fix the 'missing library' issue for the main project.

Upvotes: 0

Zain Ul Abidin
Zain Ul Abidin

Reputation: 2700

Some times eclipse becomes naughty following steps should be taken to nicely add the jar library in project

  • First remove the library from libs folder

  • Also remove the refrence from java build path in external library tab

  • Clean the project let it actually realize the library is missing :D

  • Again copy the jar file in libs folder

  • Add the refrence of library in java build path library tab

  • set the priority of this library to top (important) because its possible the order of library export is not ok in your project

  • Clean the project and build

    hope so it will solve your problem

Upvotes: 4

GhostCat
GhostCat

Reputation: 140457

These steps did resolve the problem:

  • closing / re-opening the corresponding project
  • another "full" clean of all projects in the workspace

In other words: it seems that a simple F5 "refresh" and a even a "clean project" isn't sufficient sometimes. So closing the project is the key element here!

Upvotes: 7

Related Questions