Runtime.exec(String [] cmdarray) has the following syntax.
public Process exec(String [] cmdarray) throws IOException
In the following code shows how to use Runtime.exec(String [] cmdarray) method.
/*from www .j a v a 2s . c o m*/ public class Main { public static void main(String[] args) { try { String[] cmdArray = new String[2]; // first argument is the program to open cmdArray[0] = "notepad.exe"; // data.txt is the file to open with notepad cmdArray[1] = "data.txt"; // create a process and execute cmdArray Process process = Runtime.getRuntime().exec(cmdArray); } catch (Exception ex) { ex.printStackTrace(); } } }