Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » [PDE] How to load external Jars ?
[PDE] How to load external Jars ? [message #76438] Tue, 17 June 2003 11:18 Go to next message
Eclipse UserFriend
Originally posted by: joaocm.ideais.com.br

How can I load an external Jar when developing a plugin with PDE. I've tried
to put the jar in the root folder of the plugin and write in th manifest :

<library name="xxx.jar" />

But it doesn't work.

If i put it in the build class path, it doesn't wotk too.

Thanks in advance,

Joao
Re: [PDE] How to load external Jars ? [message #76594 is a reply to message #76438] Tue, 17 June 2003 13:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bluecoder.elivefree.net

Hi,
Try right click on root of project and "properties" -> Java Build Path
-> "Add External Jars" and add it from there.

Joao Machado wrote:

> How can I load an external Jar when developing a plugin with PDE. I've tried
> to put the jar in the root folder of the plugin and write in th manifest :

> <library name="xxx.jar" />

> But it doesn't work.

> If i put it in the build class path, it doesn't wotk too.

> Thanks in advance,

> Joao
Re: [PDE] How to load external Jars ? [message #76661 is a reply to message #76438] Tue, 17 June 2003 14:50 Go to previous messageGo to next message
Eclipse UserFriend
Joao,
If you are getting a "ClassNotFoundException", it could be due to the class
loading enhancements.

Try running eclipse with the "-noPackagePrefixes" option or try declaring
all the package prefixes (for your library) in the plugin manifest file
using the <packages> element

Example:
<library name="runtime.jar">
<export name="*"/>
<packages prefixes="org.eclipse.core"/>
</library>

Sudarshan
www.spectrumscm.com


"Joao Machado" <joaocm@ideais.com.br> wrote in message
news:bcnbf2$idt$1@rogue.oti.com...
> How can I load an external Jar when developing a plugin with PDE. I've
tried
> to put the jar in the root folder of the plugin and write in th manifest :
>
> <library name="xxx.jar" />
>
> But it doesn't work.
>
> If i put it in the build class path, it doesn't wotk too.
>
> Thanks in advance,
>
> Joao
>
>
Re: [PDE] How to load external Jars ? [message #76755 is a reply to message #76661] Tue, 17 June 2003 15:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: joaocm.ideais.com.br

Yes, I'm getting ClassNotFoundException. I put the Jar in my PDE Project
root folder and in my plugin manifest file I wrote:

<library name="test.jar" />

When I try to instanciate a class that is inside this Jar the exception
occurs.

Looking at the Eclipse Wiki I've found that I must use a command line
option -dev teste.jar

but if I use this, eclipse doesn't found my Plugin.

Thanks again,

Joao

"Sudarshan Raghavan" <bali_n@yahoo.com> wrote in message
news:bcnkd2$s6n$1@rogue.oti.com...
> Joao,
> If you are getting a "ClassNotFoundException", it could be due to the
class
> loading enhancements.
>
> Try running eclipse with the "-noPackagePrefixes" option or try declaring
> all the package prefixes (for your library) in the plugin manifest file
> using the <packages> element
>
> Example:
> <library name="runtime.jar">
> <export name="*"/>
> <packages prefixes="org.eclipse.core"/>
> </library>
>
> Sudarshan
> www.spectrumscm.com
>
>
> "Joao Machado" <joaocm@ideais.com.br> wrote in message
> news:bcnbf2$idt$1@rogue.oti.com...
> > How can I load an external Jar when developing a plugin with PDE. I've
> tried
> > to put the jar in the root folder of the plugin and write in th manifest
:
> >
> > <library name="xxx.jar" />
> >
> > But it doesn't work.
> >
> > If i put it in the build class path, it doesn't wotk too.
> >
> > Thanks in advance,
> >
> > Joao
> >
> >
>
>
Re: [PDE] How to load external Jars ? [message #76835 is a reply to message #76594] Tue, 17 June 2003 15:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: joaocm.ideais.com.br

This is only for commom Java Projects. For plugins it only works at compile
time. At run-time it doesn't.

"B.C." <bluecoder@elivefree.net> wrote in message
news:bcnjg0$r5b$1@rogue.oti.com...
> Hi,
> Try right click on root of project and "properties" -> Java Build Path
> -> "Add External Jars" and add it from there.
>
> Joao Machado wrote:
>
> > How can I load an external Jar when developing a plugin with PDE. I've
tried
> > to put the jar in the root folder of the plugin and write in th manifest
:
>
> > <library name="xxx.jar" />
>
> > But it doesn't work.
>
> > If i put it in the build class path, it doesn't wotk too.
>
> > Thanks in advance,
>
> > Joao
>
>
>
>
>
Re: [PDE] How to load external Jars ? [message #76897 is a reply to message #76438] Tue, 17 June 2003 16:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: joaocm.ideais.com.br

I found the problem. My problem was bacause I was trying to instanciate a
JNDI Initial Context.

My Code is something like :
Properties prop = new Properties();

prop.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");

prop.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");

prop.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming");


Context ctx = new InitialContext(prop);

My Jar that contains org.jnp.interfaces.NamingContextFactory is
jnp-client.jar (JBOSS jnp implementation).

If I just put :

<library name="jnp-client.jar" />

at plugin manifest file it doesn't work. I have to change my classloader
using something like this :

Thread.currentThread().setContextClassLoader(MyPlugin.class. getClassLoader()
);

And finally it works as expected.

Anyone knows any other way to do that ?



Thanks again,

Joao




"Joao Machado" <joaocm@ideais.com.br> wrote in message
news:bcnbf2$idt$1@rogue.oti.com...
> How can I load an external Jar when developing a plugin with PDE. I've
tried
> to put the jar in the root folder of the plugin and write in th manifest :
>
> <library name="xxx.jar" />
>
> But it doesn't work.
>
> If i put it in the build class path, it doesn't wotk too.
>
> Thanks in advance,
>
> Joao
>
>
Re: [PDE] How to load external Jars ? [message #76943 is a reply to message #76835] Tue, 17 June 2003 17:10 Go to previous message
Eclipse UserFriend
Originally posted by: bhaskar_26.rediffmail.com

Joao,
First copy the jar file in the root directory (folder) of plugin.
Add the entry into runtime section of plugin.xml file ( I guess u r
already doing it). Also add it to the Project Properties(right click)>Java
Build path>Add External Jars.
Then it should work.

Bhaskar


Joao Machado wrote:

> This is only for commom Java Projects. For plugins it only works at compile
> time. At run-time it doesn\'t.

> \"B.C.\" <bluecoder@elivefree.net> wrote in message
> news:bcnjg0$r5b$1@rogue.oti.com...
> > Hi,
> > Try right click on root of project and \"properties\" -> Java Build Path
> > -> \"Add External Jars\" and add it from there.
> >
> > Joao Machado wrote:
> >
> > > How can I load an external Jar when developing a plugin with PDE. I\'ve
> tried
> > > to put the jar in the root folder of the plugin and write in th manifest
> :
> >
> > > <library name=\"xxx.jar\" />
> >
> > > But it doesn\'t work.
> >
> > > If i put it in the build class path, it doesn\'t wotk too.
> >
> > > Thanks in advance,
> >
> > > Joao
> >
> >
> >
> >
> >
Previous Topic:problem with IResource delete() method
Next Topic:Accesing version info
Goto Forum:
  


Current Time: Tue Jul 22 09:15:39 EDT 2025

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

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

Back to the top