The reason behind this problem is that your class file generated after the compilation of your java file is not present in the folder that is been located by the classpath. So, hence you check it by going in to Advanced system settings in the control panel and click the environment variables in the popped out window. Here you have to add the ClASSPATH field and the loaction of your jdk\bin folder. (in my case C:\Program Files (x86)\Java\jdk1.6.0\bin
If still the problem persists then add a '.' value to the CLASSPATH by using a ';' to differentiate btw two values. (in my case .;C:\Program Files (x86)\Java\jdk1.6.0\bin;)