System environment variables

Environment variable

An object with a specific name in the 应用程序所将使用到的信息operating system contains some parameters that specify the operating environment of the operating system

path environment variable

指定可执行文件的搜索路径, When the operating system does not know the complete path of the program, it tells the system which directories to search for in addition to searching for the program in the current directory. Therefore, the executable file under path, regardless of the current directory, can be found and run by the operating system.
Set temporary environment variables:
1. Syntax format: set environment variable name=temporary path
2. Other shortcut settings: set environment variable name=temporary path; %environment variable name%, under the original environment variable name setting, add temporary path
3 , When the DOS is closed, the temporary environment variable name of the environment is deleted, and the original setting is restored

CLASSPATH environment variable

  • Function: When executing java命令, tell JRE which path to search for .class file with fixed name. The virtual machine first searches for the class file according to the specified classpath. If not, check whether the current path.class file exists
  • Settings: Compiling and running Java programs requires dt.jar in the lib path of the JDK and the .class files in tools.jar.
    • Permanent setting:
      directly set the CLASSPATH in the environment variable
    • Temporary settings:
      • Tell the system the location of the java executable file (.class bytecode file), the virtual machine will only search and execute the class file according to the specified classpath.
        set classpath=某路径
        
      • Clear all previous operations on the classpath, and the classpath returns to the default value, which is the current folder
        set classpath=
        
      • Equivalent to set classpath=.; a path (that is, the current path and a path)
        set classpath=某路径; //注意此处有分号
        
    • When
      version 1.4 is not set , when compiling and running, JRE automatically loads JAVA classes in dt.jar and tool.jar, and searches for the specified .class file in the current folder

Guess you like

Origin blog.csdn.net/u013617791/article/details/103215330