[brailleblaster] Re: Executing external processes from Java

  • From: "qubit" <lauraeaves@xxxxxxxxx>
  • To: <brailleblaster@xxxxxxxxxxxxx>
  • Date: Wed, 15 Dec 2010 14:04:05 -0600

Hi Susan --
Thank you for looking further -- I indeed had not executed the subprocess as 
yet. I tried in cygwin but the java there failed.
There is one difference between your example and the code I was trying to 
execute: The child process in JSpawn is not a java program and therefore 
does not make use of the runtime environment.
Does that make a difference with your code?
I noted the definition of the java class Runtime.  There java provided 
method to control the garbage collection and other aspects of the child, 
implying that the child is a java app.
I tried to avoid using that by instead using class ProcessBuilder.

Ok, it looked like the only class that would do what I wanted.  Perhaps it 
isn't implemented fully on windows, or java isn't compatible or whatever.

My first test -- if JohnB ever gets his server updated, will be to spawn the 
"cat" program and just type input and read it from output.
Is this what you tried?
What was the program you had that failed?
--le



----- Original Message ----- 
From: "Susan Jolly" <easjolly@xxxxxxxxxxxxx>
To: <brailleblaster@xxxxxxxxxxxxx>
Sent: Wednesday, December 15, 2010 12:55 PM
Subject: [brailleblaster] Executing external processes from Java


After looking at Laura's test program and having never tried to execute an
external process from one of my Java apps, I decided to have a go on Windows
Vista.  I wrote my own spawner and used a small Java code of my own as a
subprocess.  I had trouble with the subprocess hanging when I tried to send
it additional information beyond the original command line.  After spending
way too much time Googling, I ran across some advice that looks very
worthwhile: use Apache Commons Exec.  I haven't tried it yet but the
Rationale on the below link suggests that this is a much more difficult
problem than one might expect.
http://commons.apache.org/exec/

SusanJ



Other related posts: