Search code examples
javaeclipseclasspathnoclassdeffounderror

Class seems to be in Classpath, but still NoClassDefFound error (eclipse)


I am getting the java.lang.NoClassDefFoundError: net/n3/nanoxml/XMLParseException error, but the class does seem to be in the classpath.

Since it expects XMLParseException to be in net/n3, I have added the net/n3/... folder instead of just the XMLParser because I assumed it would be looking for that hierarchy. (Although I tried it both ways, and neither worked.)

Here is the 'Referenced Libraries' sidebar: enter image description here

And here is my Run Config: enter image description here

Thanks for any help.


Solution

  • At runtime, Java will look for the class in net/n3/nanoxml/XMLParseException.class relative to the entries in the Java Build Path, whether that's a jar file or directory. So, the "net" folder would need to be underneath the entry in the Build Path, not itself be an entry in the Build Path.