0

I want to load classes that are inside a jar, that is located within another jar. Following is a hierarchy tree illustrating the location of the .class.

A.jar
|---A.class
|---B.jar
    |---InterfaceA.class

So I have a class 'A'. This class implements an interface, 'Interface B' which is inside B.jar. A third class named 'C' loads at runtime an instance of A.class. However, I end up with a java.lang.ClassNotFoundException. Any idea on how to fix this issue? I've seen plenty of posts that explains how to dynamically load classes from jar files, however I haven't seen anything that explains how to load classes from a jar file that is within another jar file.

Thanks for your time

Bilal
  • 11
  • 3
  • http://stackoverflow.com/questions/3369794/how-to-read-a-file-from-jar-in-java or google: "java read from jar" – maffo Nov 15 '16 at 20:23
  • I am able to dynamically load a class that is inside a jar file. However I still cannot figure out how to load a class that is inside a jar file that is within another jar file. – Bilal Nov 15 '16 at 20:26
  • @poixen He needs to read from external `Jar/Jar` that's not on classpath. XTrap, please check http://stackoverflow.com/questions/8312909/java-create-jar-executable-with-dependant-jars-embedded, seems there's no default implementation in JDK – 11thdimension Nov 15 '16 at 20:26

0 Answers0