Share 3rd party JARs between plugins (Buddy-Policy / SPI / JARS as plugin) [message #51639] |
Mon, 23 March 2009 23:35  |
Eclipse User |
|
|
|
Hello!
I've posted a lengthy question here:
http://www.skratchdot.com/eclipse/plugins/
Basically, I cannot figure out how to share 3rd party JARs between
plugins. I believe one of the issues is because the libraries are never
explicitly referenced in my code (3rd party JARs are using SPI). If I add
the JARs to a plugin's classpath, then everything works as expected.
I've included 3 small plugins and a lengthy explaination in the link above.
One of the plugins works as expected. The other one does not.
Can someone *please* take some time to download the examples, and help me
troubleshoot this issue?
Thanks for any help you can provide.
-jeff
|
|
|
|
|
|
|
|
|
|
Re: Share 3rd party JARs between plugins (Buddy-Policy / SPI / JARS as plugin) [message #593836 is a reply to message #51639] |
Tue, 24 March 2009 03:51  |
Eclipse User |
|
|
|
Jeff wrote:
> Hello!
>
> I've posted a lengthy question here:
> http://www.skratchdot.com/eclipse/plugins/
>
> Basically, I cannot figure out how to share 3rd party JARs between
> plugins. I believe one of the issues is because the libraries are never
> explicitly referenced in my code (3rd party JARs are using SPI). If I
> add the JARs to a plugin's classpath, then everything works as expected.
>
> I've included 3 small plugins and a lengthy explaination in the link above.
>
> One of the plugins works as expected. The other one does not.
>
> Can someone *please* take some time to download the examples, and help
> me troubleshoot this issue?
>
> Thanks for any help you can provide.
>
> -jeff
>
Hi Jeff
I tried executing your code and saw the problem you are referring.
Since the jLayer jars are external libraries, I feel the method-one is the right way to go about it. You are right in finding that method-two not working because the jars are not referenced directly.
Is there a reason you don't wish to do it method-one way?
Ankur..
|
|
|
Re: Share 3rd party JARs between plugins (Buddy-Policy / SPI / JARS as plugin) [message #593868 is a reply to message #51673] |
Tue, 24 March 2009 07:39  |
Eclipse User |
|
|
|
Ankur-
Thanks for taking the time to check out the code.
I would like to figure out how to get my plugins to use the jLayer JARs
from another plugin because I will have about 5 plugins that require
jLayer.
I do not want to have a "lib" folder in each of the 5 plugins (that
contain the same 6 JAR files).
While debugging, I notice that "Method One" loads the following classes
when correctly reading in .mp3 and .ogg files:
META-INF/services/javax.sound.sampled.spi.AudioFileReader
javazoom.spi.mpeg.sampled.file.MpegAudioFileReader
javazoom.spi.vorbis.sampled.file.VorbisAudioFileReader
"Method Two" never attempts to load those classes when clicking on an .mp3
or .ogg.
Is there a way to tell a plugin/osgi bundle to use "register" SPI classes
from another plugin/bundle?
Sorry for the questions, I'm rather new to Java / OSGI / Eclipse Plugin
development.
|
|
|
|
Re: Share 3rd party JARs between plugins (Buddy-Policy / SPI / JARS as plugin) [message #593914 is a reply to message #51827] |
Tue, 24 March 2009 10:45  |
Eclipse User |
|
|
|
Klaus-
I've actually tried that a few times (in as many variations as I could
think of). Nothing I tried worked.
I'm now thinking that it has something to do with the JARs being reliant
on SPI (Service Provider Interface).
My plugins don't actually reference any of the classes in the JARs, but
when the JARs are added to the classpath, the SPI is recognized, and
mp3/.ogg files are "auto-magically" recognized ;)
Thanks for your reply though. I had actually seen that article before
posting my question. I feel like I've tried googling everything I could
think of, and I'm not coming up w/ answers (hence the newsgroup posting) :)
|
|
|
Re: Share 3rd party JARs between plugins (Buddy-Policy / SPI / JARS as plugin) [message #593928 is a reply to message #51879] |
Tue, 24 March 2009 14:53  |
Eclipse User |
|
|
|
I think you are correct that SPI is causing you the trouble. OSGi
(Equinox) is different than a normal Java application when it comes to
class loading; it is not surprising to me that classes that are not
referenced directly from a plugin aren't visible to that plugin without
doing something special.
I suggest you post the problem to the eclipse.platform and
eclipse.technology.equinox newsgroups to see if the
OSGi/plugin-class-loading gurus there can offer any advice. This is not
really a PDE question, per se.
Hope this helps,
Eric
On 3/24/2009 10:45 AM, Jeff S. wrote:
> Klaus-
>
> I've actually tried that a few times (in as many variations as I could
> think of). Nothing I tried worked.
>
> I'm now thinking that it has something to do with the JARs being reliant
> on SPI (Service Provider Interface).
>
> My plugins don't actually reference any of the classes in the JARs, but
> when the JARs are added to the classpath, the SPI is recognized, and
> mp3/.ogg files are "auto-magically" recognized ;)
>
> Thanks for your reply though. I had actually seen that article before
> posting my question. I feel like I've tried googling everything I could
> think of, and I'm not coming up w/ answers (hence the newsgroup posting) :)
>
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.10866 seconds