I need to programmatically open a console (in windows) and from there I need to execute a large command in the console just created. I tried to write to the output stream but had no luck. Here is the code I have thus far to bring up the console.
File fileOne = new File(args[0]);
String[] command = { "cmd", "/c", "Start"};
ProcessBuilder procBuilder = new ProcessBuilder(command);
procBuilder.directory(fileOne);
Here is an example I used to create a launch icon for a program.
Runtime rt = Runtime.getRuntime();
rt.exec("cmd.exe /c cd \""+"c:\\CombineImages\\"+"\" & start cmd.exe /k \"java -Xms1G -Xmx1G jar CombineImages.jar\"");
Put that code in your main method and replace with whatever command you want to run.