Solved

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

Posted on 2006-06-13
3
188 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 104
servlet filter example 37 71
ejb stateless example 2 18
ejb message driven bean mdb creation steps 2 15
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

808 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