Thursday, March 28, 2013

ClassFoundException vs NoClassDefFoundError

ClassFoundException vs NoClassDefFoundError
There are lots of exceptions in java but these three are the one who most haunted the java developer most mainly because these three are mostly related to environment issues and they all depends upon JVM and Classpath behaviour. Though they look similar there is slight difference between ClassFoundException and NoClassDefFoundError and UnSupportedClassVersionError and we will highlight those differences here for easy understanding and differentiating these three:

1)
ClassNotFoundException comes on Runtime when requested class is not available in classpath and mainly due to call to Class.forName () or Classloader.loadClass () or ClassLoader.findSystemClass ().

2)
NoClassDefFoundError comes when problematic class was present when your compiled your application but they are not in classpath while you running your program.

No comments:

Post a Comment