NoClassDefFoundError

August 11, 2020

Here's a useful code snippet for tracking down the cause of a NoClassDefFoundError in Java. It'll tell you the actual file that a class was loaded from.

System.out.println(TheNoDefFoundClass.class.getProtectionDomain().getCodeSource().getLocation());