The moose likes Beginning Java and the fly likes Using multiple command line arguments to open multiple files Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Using multiple command line arguments to open multiple files" Watch "Using multiple command line arguments to open multiple files" New topic
Author

Using multiple command line arguments to open multiple files

Jack Sloan
Greenhorn

Joined: Mar 23, 2011
Posts: 11
Hey guys, I am trying to get the hang of CommandLine arguments and am trying to use two at a time say fro instance where I put two files in and I want my program to open both and collect statistics about it.
This is what I have.
How can I make it so two or more filenames can be added to this and then print out the results?
Thanks
Edwin Torres
Ranch Hand

Joined: Mar 19, 2011
Posts: 37
Notice that the args parameter of main() is an array:

When you pass arguments in on the command line, they are placed into that args array. So if your command line is this:

java ProcessText one two three

Then your args array will look like this:

{ "one" , "two" , "three" }


Follow me: @CompGuyProbs
Read me: Freehold Computers Examiner
Jack Sloan
Greenhorn

Joined: Mar 23, 2011
Posts: 11
Thank you I got it.
 
I agree. Here's the link: jrebel
 
subject: Using multiple command line arguments to open multiple files
 
Similar Threads
file is empty, will fail
How to call a UNIX script froma java application on AIX (using Korn shell)?
Why declaring a variable as string?
Compare two directories
Question on XSLTInputSource and NetBeans IDE 3.5.1