[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Question on executing an external program from Java code....

Posted on 2006-06-13
3
Medium Priority
?
193 Views
Last Modified: 2010-03-31
I want to execute a executable program on Windows which will take arguments and return back some parameters.

I know I need to

Runtime r = Runtime.getRuntime();
Process p = r.exec("myprogram.exe");

Should I parse all three of these?

pErrorStream = p.getErrorStream();  //for errors?
pInputStream = p.getInputStream();  //for input and program output?
pOutputStream = p.getOutputStream();  // for additonal input ?

So just to clarify for me if I want to send arguments send them to inputstream and look there too for the program you are excuting output's too?  Then OutputStream is only used to send additional input right?


thanks
ryno71
0
Comment
Question by:ryno71
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 160 total points
ID: 16895077
Yes, you need to read the Process' streams on separate threads.

>>Then OutputStream is only used to send additional input right?

Yes
0
 
LVL 30

Assisted Solution

by:Mayank S
Mayank S earned 140 total points
ID: 16895312
>> //for input and program output?

Only for reading the program output.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16895600
:-)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses
Course of the Month19 days, 18 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question