The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

The JVM is the process as far as the OS knows

Posted by Mike Nelis on May 24, 2001 at 2:38 PM

This is only a guess:
I think what may be happening here is that the process is not
ending and this is why the waitFor() method does not return.
It looks like you are using a Java application to start another
java application. Both of them are probably running on the same
JVM. The OS probably looks at all of the Java apps running on
the same JVM as one process. If this is the case, I believe the
waitFor() method will only return when the JVM exits, not when
one Java app does.

> hi,

> I am having a small problem using the Process class in
> java ( JDK1.1.6). I have written a small java class (say InputReader ) that reads the input from the keyboard and ends when the user enters the 'Ctrl+Z'.

> I have another class that starts a Process thru
> Runtime.getRuntime().exec() method and executes the above
> program "java InputReader" . The problem is that once i
> start the Process and waitFor the process to end using the Process.waitFor() method it never returns.

> This happens even when i get the OutputStream of the
> Process and write something to it and then close it.

> Thanks in advance,

> venkatesh






Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us