Home > Java > Javagetting Started > What commands are needed to compile a java program?

What commands are needed to compile a java program?

王林
Release: 2020-06-16 10:15:59
Original
12417 people have browsed it

What commands are needed to compile a java program?

#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!");
    }  
}
Copy after login

We put the program in the test directory.

What commands are needed to compile a java program?

(Video tutorial recommendation: java video tutorial)

We open the command prompt and enter the directory where the java program is located

What commands are needed to compile a java program?

Then use the javac Hello.java command to compile

What commands are needed to compile a java program?

At this time we can see in the directory Go to the bytecode file Hello.class

What commands are needed to compile a java program?

Finally we run this bytecode again and enter the following command:

java Hello
Copy after login

What commands are needed to compile a java program?

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template