You can run Java in cmd, but you are prompted when you run the javac command: ' Javac ' is not an internal or external command, or a program or batch file that can be run.
Cause: When installing Java, the path of the JDK and the path of the JRE are chosen to be the same, resulting in overwriting. At this time you can not find Tools.jar and Dt.jar under Lib.
Solve:
1) Uninstall Java, directly with Windows to uninstall the two Java-related programs;
2) Reinstall Java, install two times the opportunity to select the path, the first time is to let you choose the JDK installation path, choose the C:\Program files\java\jdk1.8.0_144, the second is to let you choose the JRE installation path, select as C:\Program Files\java\jre (new Folder JRE in Java directory);
3) Environment Configuration (Control Panel-system-Advanced system settings-environment variables)
Variable name: Path
Variable Value: C:\Program files\java\jdk1.8.0_144\bin
Open cmd, input Java,javac and java-verbose are successful, it means the installation is successful;
About the environment configuration, there are many different versions of the Internet, well, one night to try, try to doubt life ... I do not know whether it is only I can not, but write a few references (in case my computer is defective)
The first: Add the two directories of your own JDK to the front of the PATH environment variable path= C:\ProgramFiles\Java\jdk1.7.0_67\bin; C:\Program Files\java\jdk1.7.0_67\bin\jre\bin;
Second: Create a new variable (create a new Java folder on the D disk, create a new two folder under the Java file, named JDK and JRE respectively, the installation path is selected as D:\JAVA\JDK,D:\JAVA\JRE)
Variable name: Path
Variable Value: C:\programdata\oracle\java\javapath;%java_home%\bin;%java_home%\jre\bin
Variable name: java_home
Variable Value: D:\JAVA\JDK
Variable name: ClassPath
Variable value:.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar;
You can run Java in cmd, but you cannot run the Javac command