Solved

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

Posted on 2006-06-13
3
184 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:mayankeagle
mayankeagle 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
bunnyEars challenge 6 64
sumDigits  challenge 7 60
word0 challenge 3 58
eclipse formatting 6 41
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.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now