Java tutorial
import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] args) { List<String> list = new ArrayList<String>(); list.add("notepad.exe"); ProcessBuilder pb = new ProcessBuilder(list); List<String> list2 = new ArrayList<String>(); list2.add("text.txt"); // set the command list pb.command(list2); System.out.println(pb.command()); } }