Eclipse IDE: ¿cómo coloco mis archivos .jar externos en una carpeta lib?
Eclipse IDE - Can someone please tell me how I can group my external .jar files into a C:\lib folder? I'd really like have them all in a lib folder and not taking up vertical space in the root of my project (see attachment).
I have read some of the similar posts here and tried them but my projects still are not 'seeing' the needed .jar files! It's very frustrating.
I know how to add a Folder but how do I tell Eclipse my .jar folders are in c:\lib so my projects will execute? I'm not even sure if making a lib folder in my project is even related to the fact that my jar files happen to be in c:\lib.
preguntado el 27 de noviembre de 13 a las 05:11
From your description it sounds to me like you want the jars to stop taking up space in the root of your project. I am not sure how you initially added them but if I am adding external jars this is what I usually do:
Right click on your project, select properties, then Java Build Path, and then click the libraries tab, click on add external jars and then you can select each one individually (which would be a pain) or you can select them all at once if they are in the same folder (hence the c:/lib). Click OK and it should add them into a Referenced Libraries folder like so:
Also, when you open the libraries tab initially, if all of your jars show there, remove them before proceeding as you don't want to import them twice into your application (If that's even posssible, not sure).
Switch to Package explorer:
Click on Window > Show View > Package Explorer
Si desea agregar
c:\lib to your project do this:
Right click on your project, highlight build path, click Add Libraries..., in the list select
User Library, click Next, click
User Libraries... on the right. A new window will open. Click
New... and then give the library a name such as "clibs". Click OK and then highlight the new library and click add external jars. Select the jars you want from
c:/lib and then click OK. Now you can add that User library to any application you want and it will not "pile" up in the root directory under Project View.
That is just eclipse's way of displaying what libraries are on the build path of the project. It doesn't mean that they are on the root of the project, those are just references to those jars ( that maybe any-where on the system ).
A good practice is to get all the jars required by your project and put them in a folder. Next, you can either declare that folder as a library from eclipse and add that library on your build-path or you can just add the jars directly. But they will still be displayed like you are seeing them already. The true path of where these jars are located will be written next to them (like you can see in the attachment C:\selenium....).
>declare that folder as a library from eclipse and add that library on >your build-path. And how do I do that? If the lib folder is shown, at least I can collapse it and not see all those jar files. How do I declare my lib folder as a library? - rafaelf
Goto Window -> Preferences -> User Libraries -> add new library ( mention its name and add jars to it like your lib folder ). Next right click on your project -> configure buildpath -> Libraries -> add library -> User library -> the library that you created will be there just add it to the build path - saif asif
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas eclipse jar ide directory or haz tu propia pregunta.
The way you described it is the way I added the ones shown in my attachment. I know that's the way Eclipse adds them using your method, and they work but I just don't like seeing them, thus I'd really like to somehow tell Eclipse my external jar files are in c:\lib. - rafaelf
@RalphF Ah I just realized what was wrong, see my edited post. - Dan
@RalphF When you are in Project Explorer view its going to show all your added external jars in the root. - Dan
>Switch to Package explorer. Yeah, that 'hid' them. Well, that's a good work around but I'd still like to learn how to add my c:\lib jars so in Project Explorer I only see the lib folder and can collapse the jar files. But thanks for your work around. - rafaelf
@RalphF I think I found a way that will work for you, see my updated answer. I will format it, let me know if you need clarification anywhere. - Dan