Home  >  Article  >  Java  >  When compiling java, it prompts that javac cannot find the file.

When compiling java, it prompts that javac cannot find the file.

王林
王林Original
2019-11-21 10:58:483320browse

When compiling java, it prompts that javac cannot find the file.

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn