In Java learning, two system environment variables path and classpath are involved.
1. path environment variables
The path environment variable is a type of system environment variable. It is used to save a series of paths, separated by semicolons between each path. When running an executable file in the command line window, the operating system will first look for whether the file exists in the current directory. If it does not exist, it will continue to look for the file under the path defined in the path environment variable. If it is still not found, the system will report an error.
Configure environment variables in Windows 7 system:
1. Right-click [Computer] and select [Properties ]. The following interface appears:
Figure 1
2. Click [Advanced System Settings] and the following interface appears:
Figure 2
3. Click [Environment Variable] and the following interface appears:
Figure 3
4. Select the path system variable and click [Edit] to see the following interface:
Figure 4
5. Copy the bin folder path of your JDK installation directory , as shown in the figure below:
Figure 5
6. Paste the complex bin path into the path value, and note that the English half-corner symbol (;) at the end, as shown in the figure below:
Figure 6
Then, click [OK] and [OK] in Figure 3, and [Apply] in Figure 2.
7. The following is to verify whether the environment variable configuration is successful. Enter javac in the command line, and the following figure appears will be successful.
2. classpath environment variables
The classpath environment variable is also used to save a series of paths, which is viewed and configured in the same way as the path environment variable. When a Java virtual machine needs to run a class, it will look for the required class file under the path defined in the classpath environment variable.
Starting from JDK5.0, if the classpath environment variable is not configured, the Java virtual machine will automatically set it to ".", which is the current directory. Therefore, generally classpath does not require configuration.
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.