Before the environment variable is configured, use cmd to execute the Java file, you need to specify the Java executable file, otherwise it will not run.
The configuration environment is to facilitate the execution and control of Java programs without switching the executable file directory.
Then the environment variable is to let the system directly find the executable file according to the parameters of the environment variable.
The difference between system variables and user variables
User variables affect the current user, while system variables affect all users. In order to make some modifications for yourself to affect other users. So set user variables to avoid affecting other users.
If both are set, the system variable configuration will be preferred.
Steps to configure environment variables: