Wednesday, April 30, 2008

ClassNotFoundException vs. NoClassDefFoundError

ClassNotFoundException simply means that the class in not available in the CLASSPATH. You can see my previous post for tools to find the proper jar file containing the class. This exception is simpler to solve.

NoClassDefFoundError
is little tricky. This means that the class is available in the CLASSPATH and still its definition could not be loaded. The most common reason for this issue is some problem with the static block of the class in question. If you have the source check the static block of the class or if you don't have the source find the jar file in local classpath using jarscan and decompile using JAD and review the static block.

No comments: