Java FAQ javac hello Java cannot find a solution to the file

preface

For beginners, they will encounter many difficulties when they first write java code. Here is a common error, as follows:

Beginners generally start from Hello, world. After a long time of hard work, they finally want to run javac hello on DOS Java, an error will be reported: the file cannot be found

terms of settlement

Troubleshooting should be carried out in the following steps:

1. Check whether the environment variables are configured correctly. Output a javac instruction, which can output help information, indicating that the configuration information is correct (the following figure shows the environment variable configuration, no problem).

2. If the environment configuration is correct, check whether the path of the executed java file is correct.

3. This is more prone to problems. See if the java file extension is Java, if your system folder option hides the extension TXT, the file you change may be hello java. txt。

(previously, mine was hidden, and I couldn't see. Txt and. Java in the following two file suffixes)

My computer is a win10 system. Find the setting method of "Hide extensions of known file types" as follows:

This computer ― > files ― > change folder and search options ― > View ― > Advanced settings ― > the extension of known files will be hidden and unchecked

Then you can see whether your suffix is wrong.

If it is not a win10 system, it should be: my computer - > tools -- > Folder Options -- > View -- > - hide the extension of known file types, and check it to remove it.

After the above investigation, my verification is successful, which may also help you.

summary

The above is the whole content of this article. I hope the content of this article has a certain reference value for your study or work. If you have any questions, you can leave a message. Thank you for your support for programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>