Hi,
I need to be able to create a URLClassLoader at runtime which i then load classes from. I load a number of compiled classes and some jar files into the URLClassLoader like this:
where jars in an array of URLs pointing to jar files and classes is the root directory of some classes.
When i attempt to load a class (in the compiled class directory, NOT in a jar), which uses classes from one or more of the certain jars, i get a java.lang.NoClassDefFoundError.
For example, attempting
throws
because DatatypeAttribute uses SerializationContext (which is in a jar file).
But, if i try then it loads the SerializationContext class with no problems, so i know the class within the jar exists and is accessible, so why cant the call to loadClass("org.dom4j.datatype.DatatypeAttribute") load the DerializationContext class?
Some other classes which i load that use classes from other jar files load correctly.
Does anyone have any idea what can be causing this?
Thanks,
Andy