Java development skills: how to compile and run Java?

For a Java developer, the program we write must be run to show its effect. For novice students, do you know how to compile and run a Java program? Xiaoqian will tell everyone today that the steps are very detailed and bring a small book.

Java program compile and run steps

1. First, we need to install the Java environment in the windows environment, and then use the CMD operation, we open the CMD window, in which we need to enter the path where the Java program is saved, here Xiaoqian is saved in the D drive, so we first enter Go to the D drive, type d: enter
Insert picture description here

2. The second part also needs to enter the folder where the java file is saved to find this file, so we need to enter the path, Xiaoqian saves it in a folder named JAVA, and enters cd JAVA.
Insert picture description here

3. In this step, we are about to compile the Java file. We enter javac random.java in it and press Enter to execute the following. The latter is our Java file name. After execution, we will see a file with the same name in the original path. class file.
Insert picture description here

4. After that, we only need to continue back to the CMD window, enter java random in it to execute the program, and the execution result will be output below.
Insert picture description here

Guess you like

Origin blog.csdn.net/xiaoxijinger/article/details/114881891