Home  >  Article  >  Java  >  How to run java in cmd

How to run java in cmd

王林
王林Original
2019-11-11 16:13:1124774browse

How to run java in cmd

1. First, use Notepad to write a simple Java program and save it as a .Java file

How to run java in cmd

2. Search on the computer Search cmd in the text box or directly use the keyboard menu key r to open the command window

How to run java in cmd

3. Enter the cd file location in the window that appears. If I put it on the desktop, enter cd Desktop and press Press Enter. If you enter dir Desktop and press Enter, the files on the desktop will be displayed (ps: you don’t need to do this, you can also enter it directly after the file name of the Java file)

How to run java in cmd

How to run java in cmd

4. Enter javac a.java after the address where you store the Java file. a is the initial name. javac means compiling this Java file. Press Enter and a new file will appear where you store the Java file

How to run java in cmd

5. Then enter Java again and press Enter to complete the Java program. It runs and successfully outputs helloworld

How to run java in cmd

Recommended tutorial: Java tutorial

The above is the detailed content of How to run java in cmd. 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