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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Command line aurgments" Watch "Command line aurgments" New topic
Author

Command line aurgments

Ravi Kumar
Greenhorn

Joined: May 18, 2005
Posts: 4
Hi,
I have a doubt regarding Command Line Aurgments.
I want to print the values which are givin througth the Commandline Aurgments EX:-
Suppose i am giving the values from the promt as
java test abc dcb acb
while giving the one value at prompt, when ever you press the 'sapce' the value should be visible on the screen.


Ravi
Stuart Gray
Ranch Hand

Joined: Apr 21, 2005
Posts: 410
The command line arguments are stored in the args array that is passed to the main method. They can be accessed like any other array. The program below just prints out all the arguments. Note that args[0] is the first argument - the name of the program is not included.
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
though code is correct i guess that's just not what OP wants.. i guess he'd want something more like this


java amateur
Stuart Gray
Ranch Hand

Joined: Apr 21, 2005
Posts: 410
Right, gotcha. It was the use of the word 'arguments' that threw me.
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Looks like homework assingment to me, and the usual misunderstanding of 'advanced'.

Did someone else mention, that beginners-questions are more often posted to 'advanced' than 'intermediate'?


http://home.arcor.de/hirnstrom/bewerbung
Ravi Kumar
Greenhorn

Joined: May 18, 2005
Posts: 4
Thank's for reply,

But you are not getting my Question...
First try to undarstand my point then reply according to that one.

when ever giving the command line aurgments, if i press "SPACE" between the values, the value should be apper in the out put taht time only .
Mean ECHO.
In 'C' or 'C++' we are using the getChar() some ting to get the output at the same time.
suppose if u want to give more than one value from the dos prompt you have to give the 'SPACE' immediately the value should be apper in the propt.
Manuel Moons
Ranch Hand

Joined: Mar 05, 2002
Posts: 229
I think you mean you want to read some keyboard input from the console.

You can do that using the System.in object. (It is an inputstream)

something like this

miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Command line aurgments