Solved

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

Posted on 2006-06-13
3
189 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 40 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 35 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

Suggested Solutions

Title # Comments Views Activity
Java exception bubble up 2 24
Android development question 2 81
Java array 10 65
Java array sort 10 35
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 one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
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:

730 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