The most complete, when javac compiles, it keeps prompting: Can not find such and such file

The blogger struggled all night and finally found a solution (bald), dedicated to beginners like me. Here I rank them from the degree of negligence in my opinion (self-feeling high to low). Because the mistakes I made were the first type, so I mainly talk about the first type.[Insert picture description here](https://img-blog.csdnimg.cn/20200317021810316.p

The first one is the path problem

We created a file, here I assume it is a A.java file, let's pay attention to its path, it is in the demo folder on the D drive. insert image description here
But when we opened the dos window, we were surprised to find out. insert image description here
In fact, the two do not match. Some people (you can refer to me) will think that after the environment is configured, I can run it no matter where I am, but the environment configuration is to run javac and other files at any time, not the source program, so the path of our dos window must match source program, so here we need to use some dos window commands, insert image description here
so at this time we need to enter in the console: insert image description here
to complete

The second type: environment configuration

For the configuration of the environment, you can find methods in many ways. Here you can find it in many places. As long as you enter java in the dos window, javac does not report an error, then there is no problem with the environment configuration.

The third type: file name

insert image description here
Most people will not make this kind of mistake. You can see if you have closed the file extension by viewing the folder. Open it to see if the file with the suffix of java is actually in txt format.

Thanks for reading everyone.

Guess you like

Origin blog.csdn.net/Vriesianman/article/details/104913039