Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Simple Question - How Add External Jar?
Simple Question - How Add External Jar? [message #444555] Fri, 17 February 2006 16:27 Go to next message
Vincent WUHRLIN is currently offline Vincent WUHRLINFriend
Messages: 19
Registered: July 2009
Junior Member
I have find why it's impossible to create the jar in a plugin export...
In fact, when you add a external jar by using buildpath or classpath,
the jar is not created...
So, how can i add an external Jar (for exemple, i use an external jar for
read/write xml files : xstream) which is not in dependencies ?
Or the inverse question, can i add a jar in eclipse dependencies list?

Thank you very much.
Vincent
Re: Simple Question - How Add External Jar? [message #444556 is a reply to message #444555] Fri, 17 February 2006 16:55 Go to previous messageGo to next message
Nick is currently offline NickFriend
Messages: 34
Registered: July 2009
Member
hi vincent,

as far as i know, you don't and can't add jars to the eclipse
dependencies list!

the following page might help you:
http://dev.eclipse.org/newslists/news.eclipse.platform/msg48 366.html

i add my external jars the following way:
i have a directory called lib in my plugin containing all my external
jars. i added them to the classpath by using the plugin.xml editor.
(page Runtime)

don't forget to include the lib folder in the binary or source build.
(page Build)

you can also take a look at MANIFEST file. the jars should be listed
here. example:

Bundle-ClassPath: .,
lib/commons-collections-2.1.1.jar,
lib/commons-logging-1.0.4.jar,
lib/hibernate3.jar,
lib/log4j-1.2.9.jar,
lib/mysql-connector-java-3.1.10-bin.jar,
lib/xml-apis.jar
...

hope it helps
cheers,
nick



Vincent schrieb:
>
> I have find why it's impossible to create the jar in a plugin export...
> In fact, when you add a external jar by using buildpath or classpath,
> the jar is not created...
> So, how can i add an external Jar (for exemple, i use an external jar
> for read/write xml files : xstream) which is not in dependencies ?
> Or the inverse question, can i add a jar in eclipse dependencies list?
>
> Thank you very much.
> Vincent
>
>
Re: Simple Question - How Add External Jar? [message #444557 is a reply to message #444555] Fri, 17 February 2006 17:04 Go to previous messageGo to next message
Jacob Robertson is currently offline Jacob RobertsonFriend
Messages: 21
Registered: July 2009
Junior Member
The other way to do this is to create a plugin from your third party jar.
That way, if you have multiple plugins of your own, they all depend on that
plugin. We have created a plugin for each of our third party dependencies
in this way, and it works as expected.

"Vincent" <vwuhrlin@merethis.com> wrote in message
news:fedc8d76f45770363686a1249ff898dd$1@www.eclipse.org...
>
> I have find why it's impossible to create the jar in a plugin export...
> In fact, when you add a external jar by using buildpath or classpath,
> the jar is not created...
> So, how can i add an external Jar (for exemple, i use an external jar for
> read/write xml files : xstream) which is not in dependencies ?
> Or the inverse question, can i add a jar in eclipse dependencies list?
>
> Thank you very much.
> Vincent
>
>
Re: Simple Question - How Add External Jar? [message #444558 is a reply to message #444557] Fri, 17 February 2006 17:39 Go to previous messageGo to next message
Vincent is currently offline VincentFriend
Messages: 24
Registered: July 2009
Junior Member
Thanks you, i will try your solutions. But Nick, how do you create a
plugin from your third party jar? I see a little the idea but what is
really a thid party jar?

Thank you,
Vincent
Re: Simple Question - How Add External Jar? [message #444608 is a reply to message #444558] Fri, 17 February 2006 18:25 Go to previous messageGo to next message
Nick is currently offline NickFriend
Messages: 34
Registered: July 2009
Member
well, a third party jar contains code you use to accomplish your project
but didn't create yourself. examples are the log4j jar for logging, the
hibernate jar for or-mapping, and so on...

you have different options for adding these jars to your plugin or
your rcp application.

1. by turning the jars into plugins:
>> Use New>Project>Plug-in Development>Plug-in from existing JAR
>> archive. That will turn one or more jar files into a single jar
>> plugin.

you can then add this plugin (ex-jar) to the plugin dependencies list.
the advantage is that other plugins can also use it.

2. or do it the way i mentioned in the last mail.

hope it helps,
cheers,
nick


Vincent schrieb:
> Thanks you, i will try your solutions. But Nick, how do you create a
> plugin from your third party jar? I see a little the idea but what is
> really a thid party jar?
>
> Thank you,
> Vincent
>
>
Re: Simple Question - How Add External Jar? [message #444625 is a reply to message #444608] Fri, 17 February 2006 22:56 Go to previous messageGo to next message
Vincent WUHRLIN is currently offline Vincent WUHRLINFriend
Messages: 19
Registered: July 2009
Junior Member
Hello, yout ideas are really good :) I have try the first idea
(1. by turning the jars into plugins), and it's work a little :).
in fact, i use XStream and all are exported (my plugin and other new
dependency).
But the problem, Xstream use a xpp3 jar to read the xml file, and when i
integrate the two jar in a plugin, the parser crash the application.
(i dont see at all why...)
When i add the two jar by classpath (my old method) its works, but i can't
export... I have tried to create a xstream plugin, which depend of a xpp3
plugin,
but xstream doesn't find xpp3 (such when i forgot to chech the dependency
in the run menu).

So, to conclude, it will work perfectly if i will not to include this
xpp3 plugin... And yhe first idea is very good because i have need this
plugin for several application. If someone have an idea...

Maybe these jar cannot be in a plugin, but if its real i am not lucky...

If someone have an idea, i am so happy :)

Thank you very much.
Vinz
Re: Simple Question - How Add External Jar? [message #444774 is a reply to message #444625] Mon, 20 February 2006 17:27 Go to previous message
Jacob Robertson is currently offline Jacob RobertsonFriend
Messages: 21
Registered: July 2009
Junior Member
If I understand you correctly, the problem is that you now need to create
the xpp3 plugin, and then in your xstream manifest.mf make sure you add that
xpp3 plugin as a required bundle. This is the way we've done it - we have
around 20 of those types of plugins, and it works great - but you have to
excplicitly state in the manifest what bundles they require.

"Vincent" <vwuhrlin@merethis.com> wrote in message
news:76b0e008574c3687c9d0d0fd919d02fc$1@www.eclipse.org...
>
> Hello, yout ideas are really good :) I have try the first idea
> (1. by turning the jars into plugins), and it's work a little :).
> in fact, i use XStream and all are exported (my plugin and other new
> dependency).
> But the problem, Xstream use a xpp3 jar to read the xml file, and when i
> integrate the two jar in a plugin, the parser crash the application.
> (i dont see at all why...)
> When i add the two jar by classpath (my old method) its works, but i can't
> export... I have tried to create a xstream plugin, which depend of a xpp3
> plugin,
> but xstream doesn't find xpp3 (such when i forgot to chech the dependency
> in the run menu).
>
> So, to conclude, it will work perfectly if i will not to include this
> xpp3 plugin... And yhe first idea is very good because i have need this
> plugin for several application. If someone have an idea...
>
> Maybe these jar cannot be in a plugin, but if its real i am not lucky...
>
> If someone have an idea, i am so happy :)
>
> Thank you very much.
> Vinz
>
>
Previous Topic:Running a job in the same thread
Next Topic:startup views
Goto Forum:
  


Current Time: Tue Nov 12 03:22:38 GMT 2024

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

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

Back to the top