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