Loading
NoClassDefFound

Java Quick Notes

Refresh Your Java - Before Java Interview

We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....


Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet

Go to SiteMap

Q)  When do you encounter "NoClassDefFound" Exception ?


Ans)

NoClassDefFoundError exception occurs when Java Virtual Machine is not able to find a
particular class at runtime which was available during compile time. for example if
we have a method call from a class or accessing any static member of a Class and that
class is not available during run-time then JVM will throw NoClassDefFoundError.

It is important to understand that this is different than ClassNotFoundException which
comes while trying to load a class (by using Class.forName()) at run-time only and name
was provided during runtime not on compile time.

To solve this :
• Please check if the required Jar file is there in classpath by printing the classpath
 as follows"system.getParamter("classpath");" Or ECHO classpath in Server start up file.
 
• Please get and add the Jar file to class path as shown in above question.

java -cp yourJar.jar yourClass



Back to top

------------------------- We hope you got necessary Info On -----------------------------------------

NoClassDefFound


NoClassDefFound

-------------------------------------------------------------------------------------------------------



Face Book
Request for a Mock Interview/Training

Get a PDF

Face Book
Same look (Read) on any device, this is Ads free