Java basics-environment variable configuration
Method of configuring java environment variables:
1. Right-click [Computer], select [Properties], click [Advanced System Settings] to open the environment variable settings;
2. Create a new [JAVA_HOME] variable, and edit the [Path] variable;
3. Create a new [Classpath] variable and edit it can.
specific method:
1. JAVA_HOME variable setting
First, right-click [Computer] to enter [Properties] and select [Advanced System Settings] among them.
Click to enter [Environmental Variables] in [Advanced] to enter the environment variable editing interface.
In the [System Variables] below, there is no JAVA_HOME variable, then we need to click [New]
Variable name input: JAVA_HOME
variable value refers to the actual installation path (for example, the editor’s path is: C:\Program Files\ Java\jdk-9), and finally click OK.
2. Path variable setting is
also in [System Variables] we can see that the path variable already exists, then we only need to click [Edit] to enter the path variable editing
The variable name remains unchanged, the variable value is changed to [%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;], and finally click OK.
3. Classpath variable setting
Similarly, there is no Classpath variable in system variables. Click to enter [New]
Type the variable name [Classpath]
Type the variable value [.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;】
Note: Don't miss the first symbol [.] in the variable value and finally click OK.
Test environment configuration is successful
Don't forget to click OK step by step after completing the above three variable configuration.
Similarly, search for [cmd] in [Start], and then type in [java] and [javac] to see if it runs successfully.
Enter [java-version] to view the current java version.