Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » classloader and plugins
classloader and plugins [message #253144] Wed, 16 June 2004 10:15 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:test
Next Topic:nature project
Goto Forum:
  


Current Time: Mon Sep 15 20:20:53 EDT 2025

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

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

Back to the top