public static void main(String[] args) throws Exception{
String[] cmds = new String[] { "/bin/sh", "-c",
"/usr/java/tomcat/bin/a.sh" };
Process process = null;
try {
process = Runtime.getRuntime().exec(cmds, null, null);
InputStreamReader ir = new InputStreamReader(process
.getInputStream());
LineNumberReader input = new LineNumberReader(ir);
String line;
process.waitFor();
while ((line = input.readLine()) != null) {
System.out.println(line);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
process.destroy();
}
}