Part 1: Detects if the JDK is installed
Open the CMD console, enter java-version (note:-version before a space), if installed JDK will have content to display:
If the display is not an internal or external command, the JDK is not installed.
There are also two commands that can be roughly detected: Enter Java or javac in the cmd console.
If the JDK is not installed, it will display: not internal or external commands. Part 2: Download installation JDK JDK Download Address: http://www.oracle.com/technetwork/java/javase/downloads/index.html. (Note whether the computer is 32-bit or 64-bit) The installation process is very simple, just like the normal Windows program installation process. (Note: The installation path is best simple and all in English, it helps to set up environment variables and runs Java programs in the CMD console.)
After the JDK is successfully installed, the contents of the Java or java-version in the console are displayed:
But the input javac will still be displayed: not internal or external commands. Because the JDK's environment variables are not set, you cannot compile the Java program on the console at this point. part 3:JDK environment variable setting 1: Computer---> Right, Properties---> Advanced system settings---> Environment variables, the following window appears:
Our goal is to add three variables to the system variable below: Java_home,classpath,path. Java_home = c:\program files\java\jdk1.7.0_45 (is the JDK installation path) Classpath =%java_home%\lib\dt.jar;%java_home%\lib\ Tools.jar (pay attention to the front.; and two paths; path = %java_home%\bin;%java_home%\jre\bin (Note that the path variable may already exist, and if it exists, then add the path, without creating a new one.) But Java_home and classpath may need to create new ones.
Note: Creating these three environment variables can be very error-prone, we must be careful. The way to detect whether a success is set is to enter Javac in the CMD console, and if the installation succeeds there will be a series of content displayed, and if not, it will show that it is not an internal or external command.