CMD run (packaged) Java program

Source: Internet
Author: User

 Package cn.imeixi.chapter1.exer;  Public class Exer10printargs {    publicstaticvoid  main (string[] args) {          for (int i = 0;i < args.length;i++) {            System.out.println ("args[" + i + "] =" + args[i]); 
    }                     }}
 
First exer10printargs . Java to be placed in a subfolder.
For example exer10printargs . Java declaration belongs to package Cn.imeixi.chapter1.exer;
So you're going to put exer10printargs.java put it in a call cn/imeixi/chapter1/exer under the folder.

Compile, in the xxx folder previous src, then run
Javac ./cn/imeixi/chapter1/exer/exer10printargs.java "When compiling, Path with xxx/xxx/xxx "
。
Run the time, also on the xxx folder on a layer , and then run
Java cn.imeixi.chapter1.exer. Exer10printargs "When executing, package name with XXX.XXX.XXX"

SRC (home directory, all of your operations run here)
|
/cn/imeixi/chapter1/exer/ (sub-folder for all source files belonging to XXX package)
|
Exer10printargs. java

CMD run (packaged) Java program

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.