#You need to use the javac command to compile a java program.
Let’s talk about how to use this command in detail.
For example, there is a java program Hello.java
public class Hello{ public static void main(String args[]){ System.out.println("Hello world!"); } }
We put the program in the test directory.
(Video tutorial recommendation: java video tutorial)
We open the command prompt and enter the directory where the java program is located
Then use the javac Hello.java
command to compile
At this time we can see in the directory Go to the bytecode file Hello.class
Finally we run this bytecode again and enter the following command:
java Hello
Recommended tutorial: java entry program
The above is the detailed content of What commands are needed to compile a java program?. For more information, please follow other related articles on the PHP Chinese website!