It is recommended that you install the JDK and the JRE as a Custom installation directory:
My JDK is installed in: G:/0.1.develop-tools/java/jdk1.7.0_07;jre installed in: g:/0.1.develop-tools/java/jre7
Environment variable configuration:
Computer (right key)-Properties-Advanced system settings-environment variables
① new system variable (java_home)
Variable name: java_home
Variable Value: g:/0.1.develop-tools/java/jdk1.7.0_07 (this directory is the path to the JDK installation, this path includes folders such as LIB,BIN,JRE)
② Edit System variable (CLASSPATH), if not the variable will need to be new; Classpath for Java Load class (class or Lib) paths, only classes in Classpath, Java commands can recognize
Variable name: CLASSPATH
Variable value:%java_home%/lib/dt.jar;%java_home%/lib/tools.jar; (note: The variable value is placed in the classpath; where the value of the variable is finally added ";")
③ Edit System variable (PATH), if not the variable, you need to create a new; Path enables the system to recognize Java commands under any path.
Variable name: PATH
Variable value:.; %java_home%/bin; (Note: The value of the variable is placed before the existing path value)
Second, test environment variables are configured successfully, the steps are as follows
1. "Start"---> "Run" or "win+r", type "cmd";
2. Type the command "Java-version", "Java", "Javac", appear similar to the picture below