java - Can't find a class using Class.forName() -


this "test-addon"

-

and i'm trying load "main class" using:

class<?> jarclass; try {     classloader cls = classloader.getsystemclassloader();     jarclass = cls.loadclass("main.addon"); } catch (classnotfoundexception e) {     throw new invalidpluginexception("\"addon class\" not found", e); } 

as can see in image, class exists, still returns: enter image description here

line 21: jarclass = cls.loadclass("main.addon");

question: why happen

the jar or directory contains main.addon isn't on classpath.

try addon (no package specifier). in maven-style projects, src/main root (default) package.


Popular posts from this blog