File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Command line argument question. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Command line argument question." Watch "Command line argument question." New topic
Author

Command line argument question.

Roger Fed
Ranch Hand

Joined: Oct 17, 2010
Posts: 82

hello,
I have developed a class using NetBeans and i want to run it using command line , I've configured command line and it work correctly but my question is:
where this class should be stored to run it using command line arguments?
thanks........


I Hear I Forget, I See I Remember, I Do I Understand.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13868
    
  10

Anywhere you like. A class doesn't have to be stored in a special place or special way to be able to run it using command line arguments.

You can run it from a Windows command prompt with the java command, something like this:

C:\Project> java -classpath classes org.mypackage.MyProgram arg0 arg1 arg2 ...

where classes is the directory that contains the class files and org.mypackage.MyProgram is the fully-qualified name of the class that contains the main method, and arg0, arg1 etc. are the command line arguments.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Command line argument question.
 
Similar Threads
Logging
println
Compiler error!
How to run remote command from a JSP
making ant run using command line