The main cause of this error is the package name in the program. The program is as follows:
Package imputationrareprob; public class imputationrareprob {public static void main (string [] ARGs) {system. Out. println (ARGs [0]);}
Note the package at the top layer of the program. If you run the package as follows, this error will occur.
If you run it in the following way, the noclassrareprob error will occur, but if you use eclipse to run it, there will be no error. The reason is that eclipse has done a lot for us.
Javac imputationrareprob. Java
// There is no error at this point. It succeeds and then tries to run the generated. Class file, noclassdeffounderror will appear.
Java imputationrareprob
// An error will be reported here.
This is because "the package exists"
The significance of the package is to generate a directory structure, so the class file must be in the corresponding directory hierarchy, so the correct approach should be like this
Javac-D. imputationrareprob. Java
The-D option specifies the directory for generating the class file. The following screenshot shows the directory structure of the generated class file.
The second is the content in the above folder, and the execution should also be in the directory where imputationrareprob. Java is located.
Java imputationrareprob/imputationrareprob
Otherwise, the same error will occur. Therefore, you must be especially careful when compiling Java programs involving packages.