Home  >  Article  >  Java  >  What should I do if the javac command prompts that the file cannot be found?

What should I do if the javac command prompts that the file cannot be found?

王林
王林Original
2020-05-30 11:50:3415913browse

What should I do if the javac command prompts that the file cannot be found?

Cause one:

The suffix name of the java source file is wrong.

Solution:

Open the computer, select "Options" in "File" in the upper left corner and click;

(Video tutorial recommendation: java视频)

Select "View", find "Hide extensions for known file types" in "Advanced Settings", and click to remove the check mark.

What should I do if the javac command prompts that the file cannot be found?

Cause two:

The java source file and the current command are not in the same directory.

Solution:

If your Demo.java source file is under d:\ and the command line is under c:\, then you can execute the command: javac d:/Demo.java

Or enter the directory directly, type d:\, press Enter, and then execute the command: javac Demo.java. After compilation, execute the java Demo command to run.

Recommended tutorial: Getting started with java development

The above is the detailed content of What should I do if the javac command prompts that the file cannot be found?. 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