Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » classpath priority(how does eclipselink determine its classpath)
classpath priority [message #500904] Mon, 30 November 2009 04:18 Go to next message
Eclipse UserFriend
The situation I'm trying to figure out has three projects: A, B and C:
- B uses A
- C uses A and B

In Eclipse all three projects are present. Important is the following:
- Project B uses A via A.jar in its lib directory.
- Project C has project A en B directly included.
- Neither A or B have their jars marked as "exported".
- The classpath order in project C is:
* C source dirs
* project A
* project B
* all jars in its lib directory
- A.jar is NOT present in project C's classpath / lib dir.

Problem: if I click in the output console of project C on a class name that is part of project A, I end up in the class file that is inside A.jar.
A.jar can only be referenced via Project B. But the jar is not exported. How can I end up there? Especially since project A is placed before project B?

Re: classpath priority [message #500909 is a reply to message #500904] Mon, 30 November 2009 04:34 Go to previous messageGo to next message
Eclipse UserFriend
I am not sure but B project has A.jar exported right. And Project B is included in project C. Hence a logical path is there....... isn't it? I mean C to B and B to A.jar ie. C -> B -> A.jar.........

SEO
Web design and SEO company Vancouver
Re: classpath priority [message #500915 is a reply to message #500909] Mon, 30 November 2009 05:05 Go to previous messageGo to next message
Eclipse UserFriend
No. That probably is what is happening, but project B does not export A.jar. No jars are exported by any project.
Re: classpath priority [message #512167 is a reply to message #500915] Thu, 04 February 2010 04:38 Go to previous messageGo to next message
Eclipse UserFriend
Ok, same problem, different situation:

I have two projects;
- KpUtil
- DocArch

KpUtil is a generic utility project containing all my generic code. The project uses slf4j and log4j. KpUtil does not export any jars in its buildpath; none have the checkbox set on the order and export tab.

DocArch is an Swing application and uses KpUtil. It also uses slf4j and log4j. DocArch directly includes the KpUtil project, so I can cross-develop.

When I start the DocArch application slf4j gives this warning:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Documents%20and%20Settings/User/My%20Documents /tenbrinke/components/docarch /target/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLo ggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Documents%20and%20Settings/User/My%20Documents /jars/container/KpUtil /target/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLo ggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.


What is the slf4j-log4j12-1.5.8.jar in KpUtil doing in the classpath?!

I'm using Eclipse 3.5(Build id: 20090621-0832).
Re: classpath priority [message #512423 is a reply to message #512167] Thu, 04 February 2010 21:43 Go to previous messageGo to next message
Eclipse UserFriend
Tom Eugelink wrote:
> Ok, same problem, different situation:
>
> I have two projects;
> - KpUtil
> - DocArch
>
> KpUtil is a generic utility project containing all my generic code. The
> project uses slf4j and log4j. KpUtil does not export any jars in its
> buildpath; none have the checkbox set on the order and export tab.
> DocArch is an Swing application and uses KpUtil. It also uses slf4j and
> log4j. DocArch directly includes the KpUtil project, so I can
> cross-develop.
>
> When I start the DocArch application slf4j gives this warning:
>
> SLF4J: Class path contains multiple SLF4J bindings.
> SLF4J: Found binding in
> [jar:file:/C:/Documents%20and%20Settings/User/My%20Documents
> /tenbrinke/components/docarch
> /target/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLo
> ggerBinder.class]
> SLF4J: Found binding in
> [jar:file:/C:/Documents%20and%20Settings/User/My%20Documents
> /jars/container/KpUtil
> /target/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLo
> ggerBinder.class]
> SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
> explanation.
>
>
> What is the slf4j-log4j12-1.5.8.jar in KpUtil doing in the classpath?!
>
> I'm using Eclipse 3.5(Build id: 20090621-0832).
This sounds like a build path/run path issue. Your build path doesn't
have to be the same as your run time path. You can control what is on
the run time classpath from the Classpath tab of the launch config.

An alternative is to create a "library" project that only includes the
slf4j and the log4j jars. Export the jars and then have the other
projects depend on this library project.
Re: classpath priority [message #512448 is a reply to message #512423] Fri, 05 February 2010 03:27 Go to previous messageGo to next message
Eclipse UserFriend
It is indeed; the run configuration classpath contains all jars from the included project. Why? And why can't I remove them?
Re: classpath priority [message #512480 is a reply to message #512448] Thu, 04 February 2010 23:32 Go to previous messageGo to next message
Eclipse UserFriend
I would assume it contains them because you have declared that you need
the included project and that project needs these JARs. So, even though
you do not need them for building your project, they are needed for
running your project.

I suspect (though don't know for sure) that this may actually go away if
you have the project you depend on export the jars and remove them from
the dependent project. Or, alternatively, remove them from both and use
the solution proposed by David.

Steffen

On 05/02/2010 08:27, Tom Eugelink wrote:
> It is indeed; the run configuration classpath contains all jars from
> the included project. Why? And why can't I remove them?
Re: classpath priority [message #512508 is a reply to message #512480] Fri, 05 February 2010 05:31 Go to previous messageGo to next message
Eclipse UserFriend
I find the library project approach unpleasant. I understand what is does, but it's not what I want to check into revision control; that is way too much EDI specific. I need to create and check-in a new project just to work arund this issue.

And what eclipse does is not really making sense; I understand what Eclipse is doing, but it's not logical. Normally a project would result in a JAR and I would include that JAR in anoher project. For development efficiency, instead of that JAR, I include the project itself and get a whole bunch of other jars the I normally would not have.

It's not a big issue right now, but this explains a lot of problems I've been having now and then. I expected the build and runtime classpath to be indentical.
Re: classpath priority [message #512566 is a reply to message #512448] Fri, 05 February 2010 09:07 Go to previous messageGo to next message
Eclipse UserFriend
Tom Eugelink wrote:
> It is indeed; the run configuration classpath contains all jars from the
> included project. Why? And why can't I remove them?
You can remove them. Go to the Classpath tab of the launch config.
Select the project classpath under the User Entries node (its the one
that says default classpath). Select Edit and check the only include
exported entries option. The non-exported entries from the dependent
project will be removed.
Re: classpath priority [message #512579 is a reply to message #512566] Fri, 05 February 2010 09:34 Go to previous message
Eclipse UserFriend
AHA! Indeed! That is what I was looking for!

Thank you!
Previous Topic:java.lang.OutOfMemoryError on Eclipse
Next Topic:Generate Getters/Setters
Goto Forum:
  


Current Time: Mon Mar 24 10:18:16 EDT 2025

Powered by FUDForum. Page generated in 0.04625 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top