If you've programmed in Java, you've faced the NoClassDefFoundError problem.
Some times NoClassDefFoundError, some times ClassNotFoundException, some times both ...
Well, I've suffered this several times. I've solved it in that moment, but several months later it raises again, then don't remember the solution and again searching for the solution...
To stop this crazy wheel, I'll put my ideas "on a paper", then I'll always have the solution available, and of course also for you.
Well, my conclusions can be summed up in a paragraph:
NoClassDefFoundError appears when a class ClassA uses a ClassB, both have been compiled without any problem, but at runtime ClassB isn't available (problems with classpath ...).
However, with ClassNotFoundException you didn't declare ClassB in source code, but you'll need it in runtime (e.g. using reflection).
Grosso modo, that's the main difference.
See you in the next exception ...
No hay comentarios:
Publicar un comentario