User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)
Hi Everyone,
Now I am developing a RCP software using Eclipse 3.1M7. I got some
problem when invoking Bundle.loadClass(), here is the situation.
I declared an extension point in my core plugin, named extension
point "command" and defined the interface that the extension class must
implement. Then I implemented that extension point in the other plugin,
called "helper", like
<extension
id="basiccommand"
point="com.xerdoc.lifebox.commands">
<command
class="com.xerdoc.lifebox.helper.AboutCommand"
command="about"
name="About Xerdoc"/>
</extension>
and the class implemented the interface, say IInputCommand which defined
in core plugin and all class extend the point must implement it.
In core plugin, I look up the extension registry for the command and
cooresponding class information. And I want to new an instance of that
class in core plugin.
// look up in the extension registry
....
// new instance
String symbolName = extension.getNamespace();
Bundle bundle = Platform.getBundle(symbolName);
Class klass = null;
try {
klass = bundle.loadClass(className);
IInputCommand command = (IInputCommand)klass.newInstance();
.....
But I caught the NoClassDefException: com/xerdoc/lifebox/IInputCommand when
klass = bundle.loadClass(className);
I do not know why. I have added the core plugin into the dependency into
helper plugin's manifest file (plugin.xml). Sounds like that bundle's
class loader cannot find the core jar in his classpath.
Can you guys help me with that?
I know IPluginDescriptor has been deprecated in 3.1, so I am trying
using OSGi.Bundle, can you guys give me some solution for such problem?