7 public boolean exec( String cmd
, String
[] env
)
9 System
.out
.println("About to exectute " + cmd
);
11 boolean result
= false;
14 Runtime rt
= Runtime
.getRuntime();
15 p
=rt
.exec( cmd
, env
);
16 new Thread(new Runnable() {
19 BufferedReader br_in
= null;
22 br_in
= new BufferedReader(new InputStreamReader(p
.getInputStream()));
24 while ((buff
= br_in
.readLine()) != null)
26 System
.out
.println("Process out :" + buff
);
31 catch(Exception e) {}*/
33 System
.out
.println("finished reading out");
35 catch (IOException ioe
)
37 System
.out
.println("Exception caught printing javac result");
38 ioe
.printStackTrace();
48 catch( Exception e
) {} // nothing can be done
53 new Thread(new Runnable() {
55 BufferedReader br_err
= null;
57 br_err
= new BufferedReader(new InputStreamReader(p
.getErrorStream()));
59 while ((buff
= br_err
.readLine()) != null) {
60 System
.out
.println("Process err :" + buff
);
61 /*try {Thread.sleep(100); } catch(Exception e) {}*/
63 System
.out
.println("finished reading err");
64 } catch (IOException ioe
) {
65 System
.out
.println("Exception caught printing javac result");
66 ioe
.printStackTrace();
76 catch( Exception e
) {} // nothing can be done
80 int exitcode
= p
.waitFor();
83 System
.out
.println("cmd [" + cmd
+ "] failed" );
88 System
.out
.println("cmd [" + cmd
+ "] completed successfully");
93 System
.out
.println("Exception");
96 System
.out
.println("command complete");