Home  >  Article  >  Java  >  Example analysis of Java compiling and running in cmd

Example analysis of Java compiling and running in cmd

黄舟
黄舟Original
2017-10-08 09:34:401690browse

Prevent you from forgetting it every time you use it

1. Enter the path where the .java file is located

(cls clear console command )

2.javac compile

javac -d . demo1.java

javac demo1.java

such as The compiled file has a package name, javac -d . demo1.java

.class file will be generated in the cn/itcast/path path of the current path

If it is javac demo1.java command, the generated .class file is in the same directory as .java

3 .Run

java cn.itcast.path.demo1

without suffix.

The above is the detailed content of Example analysis of Java compiling and running 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