Name
Process
Synopsis
This class
describes a process that is running externally to the Java
interpreter. Note that a Process
is very different
from a Thread
; the Process
class is abstract and cannot be instantiated. Call one of the
Runtime.exec( )
methods to start a process and
return a corresponding Process
object.
waitFor( )
blocks until the
process exits. exitValue( )
returns the exit code
of the process. destroy( )
kills the process.
getErrorStream(
)
returns
an
InputStream
from which you can read any bytes the
process sends to its standard error stream. getInputStream(
)
returns an InputStream
from which you
can read any bytes the process sends to its standard output stream.
getOutputStream( )
returns an
OutputStream
you can use to send bytes to the
standard input stream of the process.
public abstract class Process { // Public Constructors public Process( ); // Public Instance Methods public abstract void destroy( ); public abstract int exitValue( ); public abstract java.io.InputStream getErrorStream( ); public abstract java.io.InputStream getInputStream( ); public abstract java.io.OutputStream getOutputStream( ); public abstract int waitFor( ) throws InterruptedException; }
Returned By
ProcessBuilder.start( )
, Runtime.exec(
)
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.