There are a number of things that can cause this error, generally based on your experience level with Java.
If you run you java program in the following manner:
You will get the java.lang.NoClassDefFoundError. This error occurs because it is looking for the myprogram.class Class within your file. To fix this, run your java program in this fashion:
Do not append the .class to the end of the file.
This error will also be thrown if the java compiler cannot find a class that is referenced through an import statement. Make sure all import files are in your class path, or you must specify them explicitly with the -classpath parameter when you compile.