classloader and plugins [message #253144] |
Wed, 16 June 2004 10:15  |
Eclipse User |
|
|
|
Originally posted by: matkavlcice.seznam.cz
hello,
I have problem with loading class. I have two plugins A and B without
dependencies. What I need is in A load class from B, I'd like to do
something like
Class cl = Class.forName( "B.SomeClass" );
problem is that classloader get error java.lang.ClassNotFoundException:
B.SomeClass
is here any possibility to solve this without declaring dependency. Whay not
dependency - because B is dependent on A (because of any other reasons)
how to force classloader to load class from other plugin?
thankx
|
|
|
Re: classloader and plugins [message #253357 is a reply to message #253144] |
Wed, 16 June 2004 14:42  |
Eclipse User |
|
|
|
Originally posted by: chaves.nospam.inf.ufsc.br
The Eclipse way of doing this is:
A provides an extension point xp1
B provides an extension ext1 to xp1
A queries xt1 for extensions, and calls
IConfigurationElement.createExecutableExtension on the configuration
elements under its extensions
This will give you one instance of the class provided by B, not the class
itself.
Another approach is:
Class cl = Platform.getBundle("B").loadClass("SomeClassProvidedByB")
In both cases, if you want to call methods on instances of the class, it
has to implement an interface/extend a class known by A.
Rafael
JohnMalcolmMcGillan wrote:
> hello,
> I have problem with loading class. I have two plugins A and B without
> dependencies. What I need is in A load class from B, I'd like to do
> something like
> Class cl = Class.forName( "B.SomeClass" );
> problem is that classloader get error java.lang.ClassNotFoundException:
> B.SomeClass
> is here any possibility to solve this without declaring dependency. Whay not
> dependency - because B is dependent on A (because of any other reasons)
> how to force classloader to load class from other plugin?
> thankx
|
|
|
Powered by
FUDForum. Page generated in 0.03299 seconds