|
-
August 10th, 1999, 11:10 AM
#1
Runtime.exec()
Hi all,
Could someone please help me with this: I am trying to run a dos/unix command within my java application by using:
String command = "ping hostname";
try {
(Runtime.getRuntime()).exec(command);
}
catch (Exception e) {}
It works fine except for the fact that I don't know how to get the output. For instance, when I issue the command "Ping hostname", it would execute successufully, but I'd like to have the output redirected to a text file: ie:
(Runtime.getRuntime()).exec("ping > result.txt");
I thought that this method should work, but it seems that no output text file is being generated.
Any help on this would be greatly appreciated.
TN
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|