This code snippet
helps to run the command/shell script in unix environment and can be
displayed in the Web environment.
try { Process p = Runtime.getRuntime().exec("uname -a"); // you can pass the system command or a script to exec command. here i used uname -a system command BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); // read the output from the command String s=""; while ((s = stdInput.readLine()) != null) { System.out.println("Std OUT: "+s); } while ((s = stdError.readLine()) != null) { System.out.println("Std ERROR : "+s); } } catch (IOException e) { e.printStackTrace(); }