Some questions about the JDK environment installation

  • Once the JDK is installed on your computer, there will be a directory to install it. The default directory is in drive C, but it will be placed in another drive, because sometimes the files in drive C will be removed when the computer reinstalls the JDK.

  • In fact, if you have installed the system on disk C, reinstall the system or change a computer also does not matter, do not need to download the JDK to install, directly remove the installed JDK installation directory, reinstall the system on the computer or a new computer can be directly used, and then configure the environment variables

  • When you configure environment variables, it is better to select system variables last. User variables are configured only for a single user.

  • When you install the JDK, the JDK comes with the JRE, but you can also install an exceptional JRE by default. By default, the jre is automatically installed, and the exceptional JRE is usually in the same directory as the JDK. Such as:



  • The difference between re-installing the JDK on a computer and copying it directly from an exceptional machine is that the re-installed JDK will have the registry on the computer and will update the JDK when networked. But the migrated JDK will not be updated. Both are available.

  • The JDK contains the JRE, and the JRE contains the JVM

  • JDK directory bin directory are binary files, most of which are. Exe files, to run this line of files, you need to run the environment JRE support.

  • The development tools: compilation tool (javac.exe), packaging tool (jar.exe) and so on

  • Until the environment variables are configured, running javac can only run in its installation directory



    Otherwise, running in another directory will report that the environment cannot be found and that the PATH environment configuration is wrong.



    Because the path environment variable is not configured, Windows will first check the path directory for the configured environment, if not, return the above error message.



    Go directly to the bin directory in the JDK installation directory, because the bin directory contains the javac.exe execution file and other exe files that can be executed. So add the D:\Java\ jdk1.8.0_221bin path to the path environment and you can execute javac in any directory

  • Running javac directly lists its parameter information

  • If you accidentally change or rename the JDK installation directory, you need to configure the corresponding path in the PATH environment variable. This can also cause the path of other environments to be deleted by mistake. The solution is as follows:

    • %% means to dynamically obtain the value of an existing environment variable, such as:
JAVA_HOME = D:\Java\jdk1.8.0_221 then change Path = %JAVA_HOME%\bin;Copy the code

The value of the path environment variable does not need to be changed, so that the error deletion will not occur. JAVA_HOME is a uniform specification, but other names are not recommended, as is MAVEN_HOME

Add JAVA_HOME and the corresponding path directly to the system variable.







When the JDK directory changes, simply change the value of JAVA_HOME!

When operating on someone else’s computer, do not want to change the environment variables configured by others, you can configure temporary variables, in DOS command operation

  • Set: You can set and view the values of environment variables

View all environment variables



Look at one of the environment variables, following set with the environment variable name, such as the value of the path variable



If the path variable is set to haha, the output haha is also haha



When the exception starts a DOS window, view the path variable with the same value



So the DOS command line configuration is only valid for the current window, when the window is closed this configuration will not be.

Configure temporary environment variables, such as the Java tools directory in a temporary DOS command



If you look at it now, this is the only value



If you add a new value to the current path environment variable,%path% Gets the original path valueThe added value is “haha”



If a new DOS window is not opened through CMD, but is opened by typing start in the existing window, the window will inherit the value of the original window variable.