JAVA configuration environment variables, java environment variables
After JDK is installed, if you want to run a java program directly in Windows, you must configure the java environment variable. Here we use win10 as an example:
Right-click "my computer" --> "properties" --> "Advanced System settings" --> "environment variables", as shown in the following figure: user environment variables and system environment variables, the user environment variables are valid only for the currently logged-on users, and the system environment variables are valid for all users. Therefore, select to configure system environment variables. In "system variables", set three attributes: JAVA_HOME, PATH, and CLASSPATH (Case Insensitive). if it already exists, click "edit". If it does not exist, click "new ". The variable setting parameters are as follows:
1. variable name: JAVA_HOME variable value: indicates the actual installation path of JDK, which should be selected based on your own situation.
2. variable name: CLASSPATH variable value:.; % JAVA_HOME % \ lib \ dt. jar; % JAVA_HOME % \ lib \ tools. jar;(Remember that there is a ".", where JAVA_HOME can be directly written as the actual Path) 3. variable name: Path variable value:% JAVA_HOME % \ bin; % JAVA_HOME % \ jre \ bin;
In the process of configuring environment variables, if there are three mentioned above, you can directly add them later. Never delete the original environment variables.
Test whether the configuration is successful:
Open cmd and enter java-version. If any, the configuration is successful!