1. Download the Java Installation Kit first
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Click Accept License Agreement and download it according to your operating system. downloaded and installed under the C:\Program Files (x86) directory.
2, Win7 System right-click on the computer to open properties → advanced system settings → TAP environment variables
3. Configure Environment variables
In "System Variables", set 3 properties, Java_home, Path, ClassPath (case does not matter), if already exist then click "Edit", do not exist then click "New".
①java_home indicates the JDK installation path, which is the path selected at the time of installation, click New, Pop Up a dialog box, variable name input java_home, variable value input C:\Program Files (x86) \java\jdk1.8.0_ 40, this path includes folders such as LIB,BIN,JRE (this variable is best set, because this variable is required to run Tomcat,eclipse later).
②path specifies a list of paths for searching the executable file, allows the system to identify the JAVA command under any path , because path already exists in the system variable, so we click Edit, add%java_home%\bin;%java_home%\jre\bin to the front ; Remember that there must be a semicolon (;) in the end.
③classpath is the Java Load Class (Classorlib) path, only the class is in Classpath, the Java command is recognized, set to:.; %java_home%\bin;%java_home%\lib\dt.jar;%java_home%\lib\tools.jar(the first to have. It represents the current path) in fact,%java_home% is referring to the previously specified Java _home;
4. Test configuration is successful
Start typing cmd, type the command "Java-version", "Java", "Javac" a few commands, the screen shows that the environment variable configuration is successful.
If ' Javac ' is not an internal or external command, it is not a running program or batch file. This explains the Java environment variable configuration error, carefully check it!
Java Learning Note 1--WINDOW7 JDK environment variable configuration diagram