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:
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.
Caused by: java.lang.ClassNotFoundException: zombie.ZombieGame
at java.security.AccessController.doPrivileged(Native Method)
Could not find the main class: zombie.ZombieGame. Program will exit.
Exception in thread "main" Java Result: 1
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.
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.