|
|
Re: Adding a jar file to eclipse [message #208819 is a reply to message #208671] |
Thu, 03 May 2007 15:54 |
Eclipse User |
|
|
|
Originally posted by: eclipse5.rizzoweb.com
Paul Rubin wrote:
> Phil Troy wrote:
>>
>> I have developed a java project using eclipse, and it works. I wish
>> to add logging to it, and have downloaded the log4j.jar. I wish to
>> make the classes in that jar file accessible to my project. Can
>> someone give me or point me to explicit step by step directions for
>> making a jar file accessible to my eclipse java project?
>>
>
> In the Package Explorer, right click on the project, select Build Path
> -> Add External Archives..., and point to the jar file. Ir should then
> show up in the Package Explorer, as if it were part of the project.
An alternative I recommend is to import/copy the JAR into your project,
put it in a /lib directory. Then you can right-click on the project,
choose Properties, then select the Java Build Path section to add the
JAR on the Libraries tab.
It is generally a good idea to have all the JARs that your code depends
on be located with the project if at all possible.
Hope this helps,
Eric
|
|
|
|
Re: Adding a jar file to eclipse [message #208891 is a reply to message #208863] |
Thu, 03 May 2007 21:50 |
Eclipse User |
|
|
|
Originally posted by: dtoland.email.uophx.edu
You can put the jar files into a project created to hold shared libraries,
add a reference to the project in other projects, and add the shared project to
the build path of other projects.
--
Dave Toland
dave.toland@verizon.net
"Paul Rubin" <rubin@msu.edu> wrote in message news:f1d47b$jrf$1@build.eclipse.org...
| Eric Rizzo wrote:
| >
| > An alternative I recommend is to import/copy the JAR into your project,
| > put it in a /lib directory. Then you can right-click on the project,
| > choose Properties, then select the Java Build Path section to add the
| > JAR on the Libraries tab.
| > It is generally a good idea to have all the JARs that your code depends
| > on be located with the project if at all possible.
| >
|
| Out of curiosity, do you do that even if the JAR is a library that will
| be used by other projects (so that you'll end up with multiple copies of
| the JAR scattered around)?
|
| /Paul
|
|
|
|
Re: Adding a jar file to eclipse [message #208898 is a reply to message #208863] |
Fri, 04 May 2007 02:20 |
Eclipse User |
|
|
|
Originally posted by: eclipse5.rizzoweb.com
Paul Rubin wrote:
> Eric Rizzo wrote:
>>
>> An alternative I recommend is to import/copy the JAR into your
>> project, put it in a /lib directory. Then you can right-click on the
>> project, choose Properties, then select the Java Build Path section to
>> add the JAR on the Libraries tab.
>> It is generally a good idea to have all the JARs that your code
>> depends on be located with the project if at all possible.
>>
>
> Out of curiosity, do you do that even if the JAR is a library that will
> be used by other projects (so that you'll end up with multiple copies of
> the JAR scattered around)?
Many times, yes. Disk space is cheap ;-)
Having each project own its dependencies is essential sometimes. Imagine
one app that needs version x of a JAR and a different app needs the same
library but version y.
Sometimes I do use a "Common Libs" project that contains commonly used
libraries, but you have to make sure the JAR files all include version
info in their names (something I always do anyway).
The end-goal is to minimize the steps required to go from virgin machine
to successful build. Having all the dependent JARs in the project helps
towards that goal, but a "Common Libs" project is reasonably close.
Eric
|
|
|
|
Powered by
FUDForum. Page generated in 0.68902 seconds