A. Download jdk
can be downloaded at Oracle website:
Http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Note Select 36-bit or 64-bit
After downloading follow the steps to install it gradually
note, however, that the JDK and JRE cannot be installed in the same directory, otherwise the Javac command cannot be found at run time
This is because the JRE only provides a Java program's operating environment, after the JDK installed, if the JRE installed in the same directory, the JRE will automatically delete some unrelated files, will be the JDK complete javac command to erase
Two. Configure environment variables (with JDK installed in G:\JAVA\JDK for example)
Java_home:g:\java\jdk
Path:%java_home%\bin;%java_home%\jrd\bin;
Classpath:.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar;
Note the quotation marks to be added in English when appending in path paths;
(Open cmd to check if the installation was successful)
Input Java-version,javac,java
can be executed correctly and the installation is successful
3. Create a new text document (take Hello.java as an example)
Use Notepad to open, and then write a Java program, where the class name to be consistent with the filename, the suffix must be modified to. java
public class hello{public
static void Main (String arg[]) {
System.out.println ("Hello world!");
}
4. Open cmd, enter the directory of your Java files (here on the desktop)
Input: Javac Hello.java for compilation
Then you can see that the Java file you wrote with the Hello.class in the same directory shows the success of compiling
Re-enter Java Hello execution
Correct output in cmd
Reprint Source: http://blog.csdn.net/bazingaea/article/details/51811542