Results 1 to 1 of 1
  1. #1
    lemmy101 is offline Member
    Join Date
    Dec 2010
    Rep Power

    Default random java.lang.NoClassDefFoundError's in Netbeans

    Hello all :)

    I'm making a game in java and it's all going pretty well so far, since I'm pretty fluent in C# the jump was quite painless, save for this one thing that's driving me mad. :(

    I'll occasionally (say 3/4 times a day while coding) get a runtime error saying something like:

    Java Code:
    java.lang.NoClassDefFoundError: zombie/ZombieGame
    Caused by: java.lang.ClassNotFoundException: zombie.ZombieGame
            at Method)
            at java.lang.ClassLoader.loadClass(
            at sun.misc.Launcher$AppClassLoader.loadClass(
            at java.lang.ClassLoader.loadClass(
    Could not find the main class: zombie.ZombieGame.  Program will exit.
    Exception in thread "main" Java Result: 1
    I've read all over people's advice saying 'make sure your classpath is right' and whatnot, but the thing is this error is totally random. I'll happen to a random class, and the first time it happen I puzzled over how to fix it.

    The solution tends to be:

    Comment out a function body in the offending class.
    Run it, let it crash from the missing contents of the function
    Uncomment the function.
    Run it again, the NoClass error will now appear for another class.
    Comment out a line from that function, run it.
    Oh dear still an error in that class.
    Comment out a different function.
    Run it.
    Rince and repeat.

    It takes like about 2 hours out of my day total, and it disappears as randomly as it appears usually after me displacing the error between 3/4 classes before finally it runs. I've tried full clean rebuilds and whatnot, and I'm at a loss. Not sure what info to provide to help anyone diagnose the problem though. :(

    I've tried extensive googling, but the only things I find are solutions that seem to imply that the program could never run without the fix, but since this is intermittent and random it feels more like a compiler bug or something.


    Last edited by lemmy101; 12-19-2010 at 06:28 PM.

Similar Threads

  1. Replies: 5
    Last Post: 03-17-2011, 02:26 PM
  2. Replies: 8
    Last Post: 11-04-2010, 01:46 PM
  3. Replies: 5
    Last Post: 06-02-2010, 01:05 PM
  4. Replies: 3
    Last Post: 06-01-2010, 03:01 PM
  5. Replies: 2
    Last Post: 09-18-2008, 07:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts