> Dimitris Terzis wrote:
>
> Hi guys...
>
> I am trying to launch an external application from my Java program,
> using exec().
>
> I do Runtime.getCurrentRuntime() and then try to exec() the
> application (not internal command), providing a properly created path.
> My application has a GUI which is never displayed. However, if I type
> "ps -aux" I can see that the process is there, which is reasonable
> since, in all cases, the Process object returned from
> Runtime.getCurrentRuntime().exec(...) is valid and no IOException (or
> whatever other error) occurs.
>
> I am running JDK 1.2.2-RC2 from Sun, on a RedHat 6.1 box.
>
> Any ideas?
I've noticed that sometimes the program being exec'd will seem to
block if you do not read its standard output. I encountered this
while working on the JProbe Solaris 2.5 installer.
Here's the relevant snippet from JProbe's Java Installshield
registration extension, which prints any output as it runs the
JProbe product at the end of the install:
// Run the product
System.out.println("Running " + product_fullname + " for registration
purposes");
try {
Process p = Runtime.getRuntime().exec("/bin/sh " + product_exe +
options);
// Get stdout
BufferedReader pOut =
new BufferedReader(new InputStreamReader(p.getInputStream()));
String s = pOut.readLine();
while (s != null) {
System.out.println(s);
s = pOut.readLine();
}
p.waitFor();
}
catch(Exception e) {
e.printStackTrace();
}
Hope this helps,
Scott
--
Scott Murray KL Group Inc.
JProbe development 260 King St. E.
Tel: (416) 594-1026, ext. 355 Toronto, Ontario
Fax: (416) 594-1919 Canada, M5A 4L5
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]