One, prepare:
1. Ensure that the computer is equipped with Eclipse software and ensure that environment variables are configured
(1) Environment variable configuration method:
Special note: JDK and Eclipse saved paths cannot have Chinese characters
1. Open My Computer--Properties--advanced--environment variables
2. New system Variable Java_home
Variable name: java_home
Variable value: The directory of the JDK, such as D:/java
3. Select the environment variable named "Path" in "System variables"
Double-click the variable to add the absolute path of the bin directory in the JDK installation path to the value of the path variable, separating it with the semicolon of the half-width and the existing path.
Variable name: Path
Added variable value:%java_home%\bin;%java_home%\jre\bin;
This is the Java environment configuration, the configuration is completed directly after the eclipse, it will automatically complete the configuration of the Java environment
Two. Create a text file, change the suffix (and rename the text type file to a Java type file) and write a full Java code
1. How to modify the file suffix:
Organization--Folder and search options--View--Hide file extension √ Remove
2. Java code in the file
Class Hello
{
public static void Main (string[] args)
{
System.out.println ("Hello World");
}
}
Three. Compiling the file Java code using CMD
1. First compile the Java file into a class file before you can use the
(1) Locate the hard drive where the current file is stored enter Javac Hello (filename) in cmd. Java then enter to compile into class file
(2) Enter Java Hello (class file name) in CMD to return
Note: The Java file name is not the same as the generated class file name, preferably in a consistent format.
Note: Jav
Write one of the simplest Java programs with cmd