Here you can find the source of exec(String args)
static private BufferedReader exec(String args) throws IOException
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { static private BufferedReader exec(String args) throws IOException { String[] splitArgs = args.split(" "); ProcessBuilder builder = new ProcessBuilder(splitArgs); Process p = builder.start(); p.getOutputStream().flush();// w w w . ja v a 2s.co m p.getOutputStream().close(); return new BufferedReader(new InputStreamReader(p.getInputStream())); } }