Net-informations.com
SiteMap  | About    

Why am I getting a NoClassDefFoundError in Java?

The definition of a class can be requested during a method call , or while creating a new instance using a new expression. NoClassDefFoundError means that the class is present in the classpath at Compile time, but it doesn't exist in the classpath at Runtime. After you compile your code, you end up with .class files for each class in your program. These binary files are the bytecode that Java interprets to execute your program. The NoClassDefFoundError indicates that the classloader , which is responsible for dynamically loading classes, cannot find the .class file for the class that you're trying to use.

The following are the three reason cause for this error:

  1. ClassNotFoundException- .class not found for that referenced class irrespective of whether it is available at compile time or not(i.e base/child class).
  2. Class file located, but Exception raised while initializing static variables
  3. Class file located, Exception raised while initializing static blocks







net-informations.com (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.