using the cmd command line under Windows, you can invoke the Javac.exe and Java.exe in the JDK to compile and execute the Java files, provided that the JDK has been successfully installed and properly configured with the relevant environment variables (JDK installation and environment variable configuration method: http:/ /blog.csdn.net/qq_32099621/article/details/51339868)
Below is a look at how Windows uses the cmd command line to compile Java files
First find the Java files that need to be compiled and executed
Here I'm going to compile and execute this Java file
Press the key combination win+r call "Run", input cmd, enter the command line
Enter the letter containing the Java file with a colon (English)
In the example, the Main.java is in the D drive, so I entered D:
Then enter the CD space plus the path to the Java file (enter the directory where the Java file resides)
Then enter the Javac space plus the file name of the Java file (the suffix is omitted) to compile the Java file
After the compilation is successful, we can find a file with the suffix. Class in the directory of the Java file, which is the resulting file after the Java file is compiled.
Back to the command line, enter the Java space in the command line plus the name of the Java file (without the suffix), then you can execute the class file and get the results of the run
This is the run result of Hello java.
If you write the Java source code is wrong, the command line will appear prompt, follow the prompts to modify the source code.
Java Learning Summary (16.05.08) compiling and executing Java files using the cmd command line under Windows