Runtime class - Invoke script and see result
Prev
Next
Runtime
java.lang.Runtime
import java.lang.*;
import java.io.*;
// Execute a system command such as "ls -l" and see the result that would
// be sent to stdout.
// For example, 'java b "ls -l"'
public class b {
public static void main (String args[]) {
InputStream is = null;
try {
is = Runtime.getRuntime().exec(args[0]).getInputStream();
} catch (IOException e) {}
BufferedReader br = new BufferedReader(new InputStreamReader(is));
try {
String str;
while ((str = br.readLine()) != null) {
System.out.println(str);
}
} catch (Exception e) {}
}
}