What causes and what are the differences between NoClassDefFoundError and ClassNotFoundException?

What is the difference between NoClassDefFoundError and ClassNotFoundException?

What causes them to be thrown? How can they be resolved?

I often encounter these throwables when modifying existing code to include new jar files.
I have hit them on both the client side and the server side for a java app distributed through webstart.

Possible reasons I have come across:

  1. packages not included in build.xml for the client side of code
  2. runtime classpath missing for the new jars we are using
  3. version conflicts with previous jar

When I encounter these today I take a trail-and-error approach to get things working. I need more clarity and understanding.

15 Answers
15

Leave a Comment