Cause one: The current compilation path is not the storage path of the java class;
Cause two: There is no definition in the java class or the defined main method is wrong.
Solution:
The first step: switch to the storage path of the java class through the "cd" command;
The second step: Reconfirm the code writing in the java class Is it correct?
Step 3: Enter "javac class name.java", press Enter, and execute. If no error is reported, the compilation is normal. If an error is reported, modify the java class code according to the error
Step 4: Enter "java class name" to run the file.
Recommended tutorial: java introductory tutorial
The above is the detailed content of When compiling java, it prompts that javac cannot find the file.. For more information, please follow other related articles on the PHP Chinese website!