Author: Mridul Muralidharan
Date: 16:49:51 02/20/06
Go up one level in this thread
On February 20, 2006 at 17:00:14, Thomas Mayer wrote:
>Hi Peter,
>
>On February 20, 2006 at 15:50:50, Peter Schäfer wrote:
>
>>On February 20, 2006 at 14:59:34, Thomas Mayer wrote:
>>
>>>
>>>P.S.: I search for the same in Java... :) There is code in José for that, but
>>>like you I would like to have something a BIT shorter... :)
>>
>>
>>Basically, it's quite simple:
>>
>> Process process = Runtime.exec("myprogram ...");
>> BufferedReader input = new BufferedReader(new
>>InputStreamReader(process.getInputStream()));
>> PrintWriter output = new PrintWriter(process.getOutputStream());
>>
>> output.println("Hello");
>> String response = input.readLine();
>>
>>It get's a bit more complicated if you want to have non-blocking IO in a Swing
>>application.
>>Here's a pretty good article:
>>http://java.sun.com/products/jfc/tsc/articles/threads/threads2.html
>
>thanks for the link and the basics... In fact I plan to program a little GUI for
>Quark in the future and since Java does become more important in my business
>life I thought it might be a good idea to write that in Java... And of course my
>first look was in the José Source to see how things could be done... ;)
>
>Greets, Thomas
Hi Thomas,
One word of caution while using Process api - it is deceptively simple.
There are lot of potential issues - including concurrency issues , so tread
carefully.
I would not normally write this here , but the sample above (which btw is how
lot of people use the api in actual code ! :-( ) is asking for trouble.
I think there are a bunch of articles in javaworld, etc which discuss this api -
ofcourse , at the end of the day , when you get around to using it : it can be
more simpler or more complex based on how you use it :-) (For me , it was more
complex ... ymmv hopefully !)
Regards,
Mridul
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.