1 10 package org.mmbase.util.externalprocess; 11 12 import java.io.File ; 13 import java.io.IOException ; 14 15 25 public class ProcessFactory { 26 27 30 static private ProcessFactory instance = new ProcessFactory(); 31 32 35 private Runtime runtime; 36 37 41 public static ProcessFactory getFactory() { 42 return instance; 43 } 44 45 48 private ProcessFactory() { 49 runtime = Runtime.getRuntime(); 50 } 51 52 59 public Process exec(String cmd) throws IOException { 60 return runtime.exec(cmd); 61 } 62 63 70 public Process exec(String [] cmdarray) throws IOException { 71 return runtime.exec(cmdarray); 72 } 73 74 84 public Process exec(String [] cmdarray, String [] envp) throws IOException { 85 return runtime.exec(cmdarray, envp); 86 } 87 88 98 public Process exec(String cmd, String [] envp) throws IOException { 99 return runtime.exec(cmd, envp); 100 } 101 102 113 public Process exec(String cmd, String [] envp, String dir) throws IOException { 114 115 if (dir != null && !"".equals(dir.trim())) { 116 return runtime.exec(cmd, envp, new File (dir)); 117 } else { 118 return exec(cmd, envp); 119 } 120 } 121 122 133 public Process exec(String cmdarray[], String [] envp, String dir) throws IOException { 134 if (dir != null && !"".equals(dir.trim())) { 135 return runtime.exec(cmdarray, envp, new File (dir)); 136 } else { 137 return exec(cmdarray, envp); 138 } 139 } 140 } 141 | Popular Tags |