I am new to this ClassLoader concept. I wasted almost a week for this but I couldn’t find any solution.
URLClassLoader jarLoader = new URLClassLoader (urlList);
Class clazz = jarLoader.loadClass(classname);
Object instance=clazz.newInstance();
(Interface1)(instance);
Here, in line 4, I’m getting ClassCastException.
Please help me resolve this? I would appreciate for any feedback.
Interface1 might have been loaded by a different class loader than you class. Classes are considered different when loaded by different class loaders.