Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse does not show lib directory during Java Build Path -> Libraries editing

I have an Eclipse/Java project (Eclipse 3.5.2) that I am trying to add some JARs to. In the root project directory I have 3 sub-directories, src, bin, and lib and all 3 sub-directories are present in the Package Explorer list. I put the needed JARs into lib. However, when I go to Project Propertes -> Java Build Path -> Libraries (tab) -> Add JARs, and the file dialog comes up, it only shows the src and bin directories in the file picker, not the lib directory. I'm guessing it is something really simple, but can someone tell me why the file picker dialog doesn't show the lib directory?

-- roschler

like image 758
Robert Oschler Avatar asked Apr 24 '11 18:04

Robert Oschler


3 Answers

After you copy a jar file to your lib folder, you need to refresh the project in Eclipse (use F5) so Eclipse knows about it.

It will then show you the lib folder in that dialog.

Note: You are correct in your answer that the said dialog doesn't reread the directory structure, but you are missing the point - it is not supposed to. That's what you have "add external jar" for. Further more, Eclipse is trying to be smart and not show you jars that you have already added (think about a folder with 50 jars and you just want to add one). That's why it didn't show you the lib folder - it thought the folder was empty.

like image 149
Yoni Avatar answered Oct 04 '22 16:10

Yoni


This is to help others. I had to do File -> Refresh to get Eclipse to see the files. Apparently file picker dialogs do not reread the disk structure. I guess they are pulling from Eclipse's main file directory image which has to be refreshed before new files are visible anywhere else in the program.

like image 25
Robert Oschler Avatar answered Oct 04 '22 17:10

Robert Oschler


This is how I resolved this problem. I created a lib folder in my java project.Then I added some jar to lib folder.

enter image description here

But it doesn't appear in my eclipse IDE.Then I selected my project and right clicked on it. Then refreshed.

enter image description here

It works for me. I think this will help you.

like image 29
Janaka Pushpakumara Avatar answered Oct 04 '22 16:10

Janaka Pushpakumara