Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 03-30-2001, 02:54 PM   #1
Member (9 bit)
 
Join Date: Jun 1999
Location: Fort Collins, CO, USA
Posts: 321
Question

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.
fade2black is offline   Reply With Quote
Old 03-30-2001, 08:26 PM   #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.
fade2black is offline   Reply With Quote
Old 03-31-2001, 12:14 AM   #3
Member (12 bit)
 
Paul Victorey's Avatar
 
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.
Paul Victorey is offline   Reply With Quote
Old 04-01-2001, 05:35 AM   #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.
fade2black is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 06:52 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2