public void run()
{
String linuxCommand = "myLinuxCommand";
try
{
Process p = Runtime.getRuntime().exec(new String[] {"sh", "-c", linuxCommand});
p.waitFor();
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while ((line = in.readLine()) != null)
System.out.println(line);
}
catch (Exception e)
{
e.printStackTrace();
}
} |