Jump to content

NoClassDef Found error in Netbeans?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
hampus.tagerud

hampus.tagerud

    Learning Programmer

  • Members
  • PipPipPip
  • 46 posts
Hi!

Yesterday when I was programming in NetBeans all of the sudden I couldn't run the project anymore, I only got the NoClassDef found exception all the time and none of the solutions online I could find worked. Only way to test it was making a clean build and then run the .jar but that's not a very comfortable solution...

So I copied the content of each file that threw the exception, deleted them, created new class files with identical names and pasted the content there. Basically it became the exact same file but when I had done this a couple of times (new classes threw the exception time after time) the application would run perfectly fine!

So my question is: why is netbeans doing this to me? It have happened before but then I just deleted the entire project and started over...

Anyone who knows anything about this?

#2
ZekeDragon

ZekeDragon

    Writes binary right handed and hex left handed

  • Moderators
  • 2,103 posts
I haven't experienced this kind of a problem with NetBeans, though it may be due to some kind of change to your project settings that you (or nefarious/random forces) made innocently enough, but then results in some serious problems when you run the project. I can't be sure since I wasn't there. :)

NoClassDefFoundError results when one executing .class file expects another .class file to exist, and to be in a location the JRE can find, but it doesn't. Your project should automagically find anything in the executing .jar file, so I'm not sure why that would happen yet. Is there any additional information you can provide that would be diagnostic to your problem, for example what you were doing prior to this error occuring?
Wow I changed my sig!

#3
hampus.tagerud

hampus.tagerud

    Learning Programmer

  • Members
  • PipPipPip
  • 46 posts
First time it occured this time was when I just added an if statement... I could run it before I added it but not after the I've added the statement so I have no idea why it wouldn't work! Maybe it's just an coincidence like you say...:)

#4
selvatheneo

selvatheneo

    Newbie

  • Members
  • Pip
  • 1 posts
may be your file name didn't match with the main class name. you may enter wrong class name which is not available. or you may did in any other packages but mistakenly removed the package statement.