I’m developing an Eclipse plugin, com.simple.plugin
, with the following structure:
The problem is that during runtime I cant access the classes of my own plugin. For example if I do the following code inside the SampleHandler.java:
Class cls = Class.forName("com.simple.handlers.SampleHandler");
Object obj = cls.newInstance();
I get the error:
java.lang.ClassNotFoundException: com.simple.handlers.SampleHandler cannot be found by com.simple.plugin_1.0.0.qualifier*
My manifest runtime option for classpath have the root of the plug-in, so I dont know what is wrong!
Your SampleHander
class is in the com.simple.plugin.handlers
package not the com.simple.handlers
package. So the correct code is:
Class<?> cls = Class.forName("com.simple.plugin.handlers.SampleHandler");
You must always specify the full package name of the class you want.