| Author |
NoClassDefFoundError and NoClassDefFoundException
|
sid kool
Greenhorn
Joined: Jan 06, 2011
Posts: 1
|
|
Hi,
What is the difference between NoClassDefFoundException and NoClassDefFoundError. i have found that NoClassDefFoundError occurs when i am using the "new" operator and the class definition is not present while running the program. When does NoClassDefFoundException occur?
Sid
|
 |
prasad guna
Ranch Hand
Joined: Feb 12, 2009
Posts: 38
|
|
Hi
This input is not sufficiant to conclude give your full code and package directory .Basically this error arise for package mismatching or missing of jars.
Thanks
|
Prasath.G
SCJP
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
NoClassDefFoundException ? what is the fully qualified name for it? is it from sun jdk ?
or you meant java.lang.ClassNotFoundException , if yes please search here or google . there are so many discussions.
And Welcome to JavaRanch
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12924
|
|
There is indeed no NoClassDefFoundException. But there is a ClassNotFoundException.
NoClassDefFoundError happens when the JVM cannot load a class that is required, almost always because you forgot to include it in the classpath.
ClassNotFoundException happens when you try to load a class via reflection (for example, when doing Class.forName("...")) and the class cannot be found. Usually this also means that the JAR or directory that contains the class file is missing from the classpath.
Note that the API documentation of NoClassDefFoundError and ClassNotFoundException also explain this, in more detail than I did above.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: NoClassDefFoundError and NoClassDefFoundException
|
|
|