ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/owl/trunk/tools/SystemCmd.java
Revision: 31
Committed: Tue Mar 14 07:40:32 2006 UTC (18 years, 7 months ago) by duarte
File size: 639 byte(s)
Log Message:
Added exec method to take only a string as argument.
Line User Rev File contents
1 filippis 13 package tools;
2    
3     import java.io.*;
4    
5     public class SystemCmd {
6    
7     public static String exec(String[] cmd) {
8    
9     String output = "";
10    
11     try {
12    
13     String line = "";
14     Process p = Runtime.getRuntime().exec(cmd);
15     BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
16     while ((line = input.readLine()) != null) {
17     output = output + line + "\n";
18     }
19     input.close();
20    
21     } catch (Exception err) {
22     err.printStackTrace();
23     }
24    
25     return output;
26    
27     }
28 duarte 31
29     public static String exec(String cmd) {
30     String[] cmdarr={cmd};
31     String output=exec(cmdarr);
32     return output;
33     }
34 filippis 13
35 duarte 31
36 filippis 13 }
37    

Properties

Name Value
svn:executable *