An approach to avoid the above described java.lang.NoClassDefFoundError:
When referring to an existing class or package get the meta information from a textual reference to this class directly instead of using String literals.
Another advantage is that refactorings (rename or move to another package) of the referenced class is applied to the class name (and import declarations if needed) in the code automatically.