|
Re: common jar in more projects [message #721686 is a reply to message #721671] |
Fri, 02 September 2011 14:46 |
|
On 02-Sep-11 07:53, chiara wrote:
> Hi,
>
> I've 3 projects in Eclipse:
>
> 1- "UtilityProject" and into the classpath I have added "log4j.jar"
>
> 2- "ProjectB" that uses "utilityProject.jar" and "log4.jar". I have
> added into the classpath "utilityProject.jar" and "log4j.jar"
>
> 3- "ProjectC" that uses "utilityProject.jar" and "log4.jar" and
> "projectB.jar". I have added into the classpath "utilityProject.jar" and
> "log4j.jar" and "projectB.jar"
>
> It works but..
> Is there a way to use "log4j.jar" in others projects without add
> directly "log4j.jar" into their classpath?
>
> [snip]
The short answer is no (I'm pretty sure), but there is a way, at least
for Dynamic Web Projects, to share their classpath entries with other
projects "automatically" by using Build Path -> Configure Build Path ->
Libraries tab -> Add Library... -> Web App Libraries.
There is also a way, though it's not very portable because it involves
full paths in your host's filesystem, of creating one or more User
Libraries that you can more easily add to new projects inside your
workspace. A User Library can be composed of any JARs you like including
source code and Javadoc wiring, then added (via Build Path) to the new
project.
If you like, see
http://www.javahotchocolate.com/tutorials/jar-libraries.html
Hope this helps.
|
|
|
Re: common jar in more projects [message #721705 is a reply to message #721686] |
Fri, 02 September 2011 15:06 |
David Wegener Messages: 1445 Registered: July 2009 |
Senior Member |
|
|
On 09/02/2011 09:46 AM, Russell Bateman wrote:
> On 02-Sep-11 07:53, chiara wrote:
>> Hi,
>>
>> I've 3 projects in Eclipse:
>>
>> 1- "UtilityProject" and into the classpath I have added "log4j.jar"
>>
>> 2- "ProjectB" that uses "utilityProject.jar" and "log4.jar". I have
>> added into the classpath "utilityProject.jar" and "log4j.jar"
>>
>> 3- "ProjectC" that uses "utilityProject.jar" and "log4.jar" and
>> "projectB.jar". I have added into the classpath "utilityProject.jar" and
>> "log4j.jar" and "projectB.jar"
>>
>> It works but..
>> Is there a way to use "log4j.jar" in others projects without add
>> directly "log4j.jar" into their classpath?
>>
>> [snip]
>
>
> The short answer is no (I'm pretty sure), but there is a way, at least
> for Dynamic Web Projects, to share their classpath entries with other
> projects "automatically" by using Build Path -> Configure Build Path ->
> Libraries tab -> Add Library... -> Web App Libraries.
>
> There is also a way, though it's not very portable because it involves
> full paths in your host's filesystem, of creating one or more User
> Libraries that you can more easily add to new projects inside your
> workspace. A User Library can be composed of any JARs you like including
> source code and Javadoc wiring, then added (via Build Path) to the new
> project.
>
> If you like, see
> http://www.javahotchocolate.com/tutorials/jar-libraries.html
>
> Hope this helps.
Yes, you can do this. In the Utility project go to the Build Path
dialog and select the Order and Export tab. Click on the log4j.jar.
In the ProjectB Build Path dialog go to the Project References page and
add Utility project. Export Utility project from ProjectB
Do similar for ProjectC.
|
|
|
Re: common jar in more projects [message #722084 is a reply to message #721705] |
Sun, 04 September 2011 10:58 |
chiara Messages: 2 Registered: September 2011 |
Junior Member |
|
|
dpwegener wrote on Fri, 02 September 2011 11:06On 09/02/2011 09:46 AM, Russell Bateman wrote:
> On 02-Sep-11 07:53, chiara wrote:
>> Hi,
>>
>> I've 3 projects in Eclipse:
>>
>> 1- "UtilityProject" and into the classpath I have added "log4j.jar"
>>
>> 2- "ProjectB" that uses "utilityProject.jar" and "log4.jar". I have
>> added into the classpath "utilityProject.jar" and "log4j.jar"
>>
>> 3- "ProjectC" that uses "utilityProject.jar" and "log4.jar" and
>> "projectB.jar". I have added into the classpath "utilityProject.jar" and
>> "log4j.jar" and "projectB.jar"
>>
>> It works but..
>> Is there a way to use "log4j.jar" in others projects without add
>> directly "log4j.jar" into their classpath?
>>
>> [snip]
>
>
> The short answer is no (I'm pretty sure), but there is a way, at least
> for Dynamic Web Projects, to share their classpath entries with other
> projects "automatically" by using Build Path -> Configure Build Path ->
> Libraries tab -> Add Library... -> Web App Libraries.
>
> There is also a way, though it's not very portable because it involves
> full paths in your host's filesystem, of creating one or more User
> Libraries that you can more easily add to new projects inside your
> workspace. A User Library can be composed of any JARs you like including
> source code and Javadoc wiring, then added (via Build Path) to the new
> project.
>
> Hope this helps.
Yes, you can do this. In the Utility project go to the Build Path
dialog and select the Order and Export tab. Click on the log4j.jar.
In the ProjectB Build Path dialog go to the Project References page and
add Utility project. Export Utility project from ProjectB
Do similar for ProjectC.
I created "utilityProject"
I added log4j in buildPath
BuildPath -> Configure Build Path -> Order And Export -> checked log4j.jar
I created "ProjectB"
BuildPath -> Configure Build Path -> Project References -> checked UtilityProject
BuildPath -> Configure Build Path -> Projects -> Add -> checked UtilityProject
BuildPath -> Configure Build Path -> Order And Export -> checked Utilityproject
I created "ProjectC"
BuildPath -> Configure Build Path -> Project References -> checked ProjectB
BuildPath -> Configure Build Path -> Projects -> Add -> checked ProjectB
I export ProjectC as Java Runnable JAR
It works.
Thank you very much.
Regards
[Updated on: Sun, 04 September 2011 10:58] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.08683 seconds