blob: 241dfde816d40610edabef30a0fc7b72f4074d42 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// Create a process and verify failure exit code.
public class Process_4
{
public static void main(String[] args)
{
try
{
Runtime r = Runtime.getRuntime();
String[] a = { "false" };
Process p = r.exec(a);
int c = p.waitFor();
System.out.println(c == 1 ? "ok" : "bad");
}
catch (Exception ex)
{
System.out.println(ex.toString());
}
}
}
|