Developing a Java application typically consists of three steps :
1. Create a source file with the file name extension *.java
1). Using the editor (such as Notepad, the notepad++ is used), enter the following 6 lines of text:
1 // A simple application example: print a line of text 2 class Hello {3 Public Static void Main (String args[]) {4 System.out.println ("Hello java,this is my first Java application!" ); 5 }6 }
The input is complete, as shown in
2). Name the file name Hello.java, and save it,
2. Using the Java Editor Javac.exe compile the source file to generate a byte-code file with the file extension *.class
1). win+r, enter CMD in the text box, and enter into the DOS window.
2). Use the CD command to transfer the path to the path where the source file "Hello.java" is located (CD usage can refer to the CD command of the Doc window), enter the "Javac Hello.java" command.
At the same time, we can find the source file "Hello.java" in the folder of a more than one bytecode file (editor Javac.exe compiled results), this is the right.
3. Java.exe running bytecode using the Java interpreter
Under current path, enter "Java Hello" command, carriage return. The operation results are as follows
The road to Java is successful.
Summarize
Use Notepad to write code that has a positive effect on the typing habit, while running the code with a DOS window to better understand the entire process of running Java.
Good programmers must have good habits!
The Essays! 2017-05-11 22:37:23
To create and run a simple Java program