aspose file tools*
The moose likes Java in General and the fly likes Runtime exec Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Runtime exec" Watch "Runtime exec" New topic
Author

Runtime exec

Karthik Veeramani
Ranch Hand

Joined: Dec 22, 2002
Posts: 132
I have to execute a command line many times when some event is triggered. For this Ive been using Runtime.exec() for executing each command line. This seems to take up a lot of memory. Is there a better way to do it?


Thanks<br />Karthik<br />SCJP 1.4, CCNA.<br /> <br />"Success is relative. More the success, more the relatives."
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

"Karthik" -
Please review our site's naming policy at your earliest convenience. We prefer that all screen names follow this convention. Thank you.
There are other ways to accomplish what you want, but none of them are nearly so simple as what you're doing now. For more efficient use of resources, you'll probably need to create a program that can thread your command-line invocations within a single process space.
It's also possible that what you're invoking might be easily rewritten to be more efficient.


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Karthik Veeramani
Ranch Hand

Joined: Dec 22, 2002
Posts: 132
Thanks. And sorry about the name, I've changed it to my full name.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Runtime exec