sweet dreams
sweet dreams

Reputation: 2134

Eclipse - why cant it integrate jars in lib folder into project?

I manually copy needed jar files into my project lib folder. Then, I try to add them to build path via "configure build path option". If i choose "add jar", then the lib folder does not show up in the "to choose from" list. So, I am forced to use "add external jars" option instead. But, that option does not make the jars a part of the project even though they lie in the lib folder. After I restart eclipse 2-3 times, the jars are magically integrated into my project.

Why is eclipse behaving this way ? Why can't I do this easily ? Please help me.

Upvotes: 1

Views: 1750

Answers (2)

Rangi Lin
Rangi Lin

Reputation: 9461

By default, Eclipse dose not detect file change which come from outside, like copy a jar file in lib folder manually.

So after you copied jar files, you have to refresh the project by pressing F5 while selecting your lib folder. I believe that's why eclipse cannot found your jar files.

If you want to solve this problem once for all, you can active "Refresh using native hooks or polling" via

Window -> Preference -> General -> Workspace

However, this might slow down Eclipse if you have a big project with many many files.

UPDATE

As Bananeweizen mentioned, instead of doing all the copied from outside of Eclipse, you can also copied those file into Eclipse, Package Explorer View for example. This way Eclipse will detect and refresh folder automatically.

Upvotes: 2

Craig Smith
Craig Smith

Reputation: 48

The way I was taught to add external jars to an eclipse project is to drag the jar file from explorer into the lib folder in eclipse and then on the dialogue eclipse responds with is choose the copy to option and eclipse imports the jar file and copies it to the lib location at the same time.

Upvotes: 1

Related Questions