Home  >  Article  >  Java  >  What command do you need to use to compile a java program?

What command do you need to use to compile a java program?

王林
王林Original
2020-07-09 13:32:2725869browse

To compile a java program, you need to use the javac command. The usage method is: 1. Open the command prompt and enter the directory where the Java file is located; 2. Execute the [javac file name.java] command and press Enter. At this time, a class file will be generated in the directory where the Java file is located.

What command do you need to use to compile a java program?

#You need to use the javac command to compile a java program.

(Recommended learning: java introductory program)

Related introduction:

How to compile a java program through the javac command?

1. Open cmd and enter the folder where the .Java file is located.

Since my source files are in the JAVA folder of the D drive, I need to enter the D drive first (enter d: Enter)

What command do you need to use to compile a java program?

2 , enter the D drive, and then enter the JAVA folder. After entering cd JAVA, press the Enter key.

What command do you need to use to compile a java program?

3. Enter the javac random.java command and press the Enter key to compile the program.

What command do you need to use to compile a java program?

(Video tutorial recommendation: java video tutorial)

The compilation is completed. You can see that a .class file is generated in the directory where the .java file is stored.

What command do you need to use to compile a java program?

4. At this time, execute the java random command to run the program.

What command do you need to use to compile a java program?

The above is the detailed content of What command do you need to use to compile a java program?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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