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.
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.
But when we opened the dos window, we were surprised to find out.
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,
so at this time we need to enter in the console:
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
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.