Java running shows "Cannot find or cannot load the main class"!

Java running shows "Cannot find or cannot load the main class"!
The environment variables are also configured, but this problem occurs.
The reason is that I edited the Java files in the IDE in advance. That file is under the package.
But when going to the Java file on the command line.
This problem arises because of being under the package.
Solution
Create a Java file in the folder by yourself without going through the compiler. Then it can be resolved normally. Because the compiler takes the package name, we can't let it take the package name.

Guess you like

Origin blog.csdn.net/weixin_45663946/article/details/108458464