• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NoClassDefFound.

 
Ravi Mutyala
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a class, in whose main() the same class is instantiated. like
class xyz{
public static void main(String[] args)
{
xyz a = new xyz();
}
}
I'm able to compile this file, there is a NoClassDefFound. If I use another class abc in whose main, i instantiate xyz, it it working fine.
what could be the problem? The classpath seems ok, as it is working in the second case.
Thanks in advance.
Ravi.
 
John Twenty
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You did forget to implement a default constructor!
Greetz
 
William Barnes
Ranch Hand
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java gives you a default ctor, if you don't make one. (I think.)
Is the file the same name as the class?
 
Ravi Mutyala
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did infact put a constructor. While giving the example of this situation, I skipped the constructor.
Has anyone else faced this strange problem?
 
Ravi Mutyala
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by William Barnes:
Java gives you a default ctor, if you don't make one. (I think.)
Is the file the same name as the class?

Yep. The class name and file name are same. And I'm able to instantiate and use this class in another class. The problem is only when I try to instantiate the same class in the main().
 
John Twenty
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i start the main method it works! strange!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic