1 *java.lang.Process* *Process* TheProcessBuilder#start()andRuntime#exec(String[],
3 public abstract class Process
4 extends |java.lang.Object|
6 |java.lang.Process_Description|
7 |java.lang.Process_Fields|
8 |java.lang.Process_Constructors|
9 |java.lang.Process_Methods|
11 ================================================================================
13 *java.lang.Process_Constructors*
16 *java.lang.Process_Methods*
17 |java.lang.Process.destroy()|Kills the subprocess.
18 |java.lang.Process.exitValue()|Returns the exit value for the subprocess.
19 |java.lang.Process.getErrorStream()|Gets the error stream of the subprocess.
20 |java.lang.Process.getInputStream()|Gets the input stream of the subprocess.
21 |java.lang.Process.getOutputStream()|Gets the output stream of the subprocess.
22 |java.lang.Process.waitFor()|causes the current thread to wait, if necessary, u
24 *java.lang.Process_Description*
26 The (|java.lang.ProcessBuilder|) and Runtime.exec(|java.lang.Runtime|) methods
27 create a native process and return an instance of a subclass of Process that
28 can be used to control the process and obtain information about it. The class
29 Process provides methods for performing input from the process, performing
30 output to the process, waiting for the process to complete, checking the exit
31 status of the process, and destroying (killing) the process.
33 The methods that create processes may not work well for special processes on
34 certain native platforms, such as native windowing processes, daemon processes,
35 Win16/DOS processes on Microsoft Windows, or shell scripts. The created
36 subprocess does not have its own terminal or console. All its standard io (i.e.
37 stdin, stdout, stderr) operations will be redirected to the parent process
38 through three streams ( (|java.lang.Process|) , (|java.lang.Process|) ,
39 (|java.lang.Process|) ). The parent process uses these streams to feed input to
40 and get output from the subprocess. Because some native platforms only provide
41 limited buffer size for standard input and output streams, failure to promptly
42 write the input stream or read the output stream of the subprocess may cause
43 the subprocess to block, and even deadlock.
45 The subprocess is not killed when there are no more references to the Process
46 object, but rather the subprocess continues executing asynchronously.
48 There is no requirement that a process represented by a Process object execute
49 asynchronously or concurrently with respect to the Java process that owns the
61 *java.lang.Process.destroy()*
63 public abstract void destroy()
65 Kills the subprocess. The subprocess represented by this Process object is
70 *java.lang.Process.exitValue()*
72 public abstract int exitValue()
74 Returns the exit value for the subprocess.
78 Returns: the exit value of the subprocess represented by this Process object. by
79 convention, the value 0 indicates normal termination.
81 *java.lang.Process.getErrorStream()*
83 public abstract |java.io.InputStream| getErrorStream()
85 Gets the error stream of the subprocess. The stream obtains data piped from the
86 error output stream of the process represented by this Process object.
88 Implementation note: It is a good idea for the input stream to be buffered.
92 Returns: the input stream connected to the error stream of the subprocess.
94 *java.lang.Process.getInputStream()*
96 public abstract |java.io.InputStream| getInputStream()
98 Gets the input stream of the subprocess. The stream obtains data piped from the
99 standard output stream of the process represented by this Process object.
101 Implementation note: It is a good idea for the input stream to be buffered.
105 Returns: the input stream connected to the normal output of the subprocess.
107 *java.lang.Process.getOutputStream()*
109 public abstract |java.io.OutputStream| getOutputStream()
111 Gets the output stream of the subprocess. Output to the stream is piped into
112 the standard input stream of the process represented by this Process object.
114 Implementation note: It is a good idea for the output stream to be buffered.
118 Returns: the output stream connected to the normal input of the subprocess.
120 *java.lang.Process.waitFor()*
122 public abstract int waitFor()
123 throws |java.lang.InterruptedException|
125 causes the current thread to wait, if necessary, until the process represented
126 by this Process object has terminated. This method returns immediately if the
127 subprocess has already terminated. If the subprocess has not yet terminated,
128 the calling thread will be blocked until the subprocess exits.
132 Returns: the exit value of the process. By convention, 0 indicates normal termination.