For example, if you want to execute the Java command, you do not set the environment variable path including your JDK installation path, where the system goes to find your Java.exe file.
If you execute a command, the system cannot find the corresponding. exe in the current folder, then the system will go to the path contains the paths to find out if you can know the corresponding. exe, once found the first corresponding. exe to run the command, the other path is not found. If you can't find it, you'll see a "system can't find a command" prompt.
Other environment variables are used just for storing information, which can be used by the system or used by your application.
Environment variables can be considered as global variables of a computer
such as Java_home, can be accessed through the command line after definition, such as the DOS command line input echo%java_home%, you can view the value of the environment variable. Similarly Unix can be viewed under the command line using the Echo $JAVA _home.
These variables are referenced in the program, in the same way as in the command line, and can be accessed with% variable name% (Windows) or variable name (Unix).
Why do environment variables have to be set for environment variables?