In the Beginner Java programming language, the painful thing is to follow the example step by step, always get the desired results, this is a lot of beginners will encounter problems. Here's a detailed teach you to run the first Java application (environment Windows XP + JDK 6.0):
First step: Download and install JDK 6.0, install the road to: C:\java\jdk1.6.
Second step: Right-click on "My Computer", select "Properties", select "Advanced" tab in the "System Properties" window, then press "Environment variable" button, pop up an "environment variable" window, create a new variable in the system variable named "Java_home", the variable value is "C:\java\ jdk1.6 "; If there is a" PATH "variable name, press Edit and enter" C:\java\jdk1.6\bin; "at the top of the variable value. (Note that the semicolon ends with no quotation marks.) If you do not have "path", click the new "path" variable name, the value of the variable.
Step three: Click Windows XP Start, run, enter CMD in the popup run window, press ENTER, open a command line window, enter Javac, you will see a series of Javac common parameter options. Congratulations to you. The Java environment was installed successfully.
Fourth step: Start programming (note Double-click to open My Computer, click "View" Options, "Tools", "Folder Options"), and in "Advanced settings", find the "Hide extensions of known file types" in front of the small tick removed). Create a new subdirectory in the root directory of the C drive, called "Javatest", as the place where Java source code resides. In the Javatest folder, create a new text document and change "new text document. txt" to "Helloworld.java". Open "Helloworld.java" with Notepad and enter:
public class HelloWorld {
public static void Main (string[] args) {
System.out.println ("Hello, world!");
System.out.println ("Congratulations on successfully running your first Java application!");
}
}
Note The source file name must be the same as the class name, and the class modifier is public and the filename suffix is ". java". Save the file.
Fifth Step: Enter CD C:\JavaTest in the Command Line window and transfer the current path to the Javatest directory. Then, enter Javac HELLOWORLD.JAVA,JDK to build a Helloworld.class class file in the Javatest folder.
Sixth step: Enter Java HelloWorld in the Command Line window (note that there is no. class suffix) the screen appears
Hello world!
Congratulations on successfully running your first Java application!
Successful, the first Java application was compiled and run successfully.
Note the file suffix!!! I personally think it is important to remove the hidden extension name! I've been in this hole for a long time! Remove the hidden only to find my file is *.java.txt! this is not a pit!!!
I combined myself to go the wrong way, and the online god of the answer, hope to be helpful.
Java Environment Setup and operation