- 1
Download the JDK and follow the prompts to install it, and finally note the installation location where the JDK is located, assuming C:\Program Files (x86) \java\jdk1.8.0_20
- 2
Now start configuring environment variables.
Right click on "Computer", select Properties, click "Advanced System Settings", click on "Advanced", finally click "Environment variable", enter the interface to start the configuration
- 3
Tip: If you select User variables, the variables you configure are only valid for that user
If you select System variables, it is valid for all users.
Here we select "System variables".
- 4
We click "New" in "System variables".
The variable name is: Java_home
The variable value is: C:\Program Files (x86) \java\jdk1.8.0_20
Remember, sure.
PS: Variable value is the path to your JDK installation I'm here for C:\Program Files (x86) \java\jdk1.8.0_20
- 5
We click "New" in "System variables".
The variable name is: CLASSPATH
The value of the variable is:.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar; (Remember that there's a "." In the front. and a ";").
PS: Variable value if ".;" It seems to be OK (I have a book like this)
- 6
We find "path" in the "System variables" (we just need to add one).
Be careful to backup your path before configuring this variable to prevent accidental deletion of!!!!!
What you need to add is: the JDK installation path plus "\ Bin",
Like me here is: "; C:\Program files (x86) \java\jdk1.8.0_20\bin" I'm putting him on the last side, if you want to add it to the front: "C:\Program files (x86) \java\ Jdk1.8.0_20\bin; "
See, actually, there's a change in the position of the semicolon.
PS: This place to add, I tried a lot of ways on the Internet can not, I have tried their own ideas, the Internet to add to the "JDK installation path +\bin", the result is OK.
The following is my configuration for reference only:
C:\Program Files (x86) \nvidia Corporation\physx\common; C:\Program Files (x86) \microsoft DirectX SDK (August) \utilities\bin\x86;%systemroot%\system32;%systemroot%;% systemroot%\system32\wbem;%systemroot%\system32\windowspowershell\v1.0; C:\Program Files (x86) \java\jdk1.8.0_20\bin
- 7
After configuration, come to the CMD interface and enter "Java" and "Javac" to see if the configuration is successful!
In fact, as long as the "Java_home" and "CLASSPATH" configuration is correct, the JAVA command will succeed, if the "path" configuration has a problem, the Javac command will fail.
END
My understanding of the environmental variables