|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (9 bit)
Join Date: Jun 1999
Location: Fort Collins, CO, USA
Posts: 321
|
I have a java program that will time the sorting of an integer array. It has only a main method that accepts command line arguments to select the type of sort and size of array. I want to run this program several different size arrays using each type of sort to test the relative performance of the sorts. Therefore, I would like to be able to create a "driver program" that runs this java program several times, feeding it a different command line argument each time. Your help is greatly appreciated.
|
|
|
|
|
|
#2 |
|
Member (9 bit)
Join Date: Jun 1999
Location: Fort Collins, CO, USA
Posts: 321
|
Actually, all I need to know how to do is to use a Java application with command line arguments from inside another program. I have already coded the part to generate the various inputs I want to use. I just need a way to "feed" these Strings into the test program as command line arguments. I hope this helps to better define my question.
|
|
|
|
|
|
#3 |
|
Member (12 bit)
Join Date: Mar 1999
Location: MN or WI
Posts: 3,017
|
Hmm, usually if I'd try something like this, I'd simply copy the source code, change the main method into simply a normal class method, and simply call it with the inputs you wanted, from within the program.
__________________
Paul M. Victorey ------------------ I am not responsible for any problems that may arise as a result of following my advice. This includes, but is not limited to, computer failure, loss of data, nuclear war, famine, boils, no clean laundry, your daughter running off with a biker gang, or armageddon. Take my advice at your own risk. |
|
|
|
|
|
#4 |
|
Member (9 bit)
Join Date: Jun 1999
Location: Fort Collins, CO, USA
Posts: 321
|
Thanks for the idea. I actually ended up doing almost exactly that. I copied the for loops that generated the input combinations into the main method of the other class. I only had to switch the code to accept the for loops as input instead of the command line args[] array. I guess I should have done that to begin with. I was just curious to see if there was a way to redirect I/O in such a way that would not require modifying source code.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|