I\'m trying to execute javac from Java using ProcessBuilder but i get no output and nothing happens. I tried reading the input stream (as there is a bug where the process hangs
The string array that you pass to ProcessBuilder should contain one argument per array element, not everything in a single big string.
Try this:
String[] commands = new String[] { "C:\\Windows\\System32\\cmd.exe", "/c", "C:\\\"Program Files\"\\Java\\jdk1.6.0_23\\bin\\javac.exe" };
Btw: there is no need to call cmd.exe, you can pass javac.exe directly to the ProcessBuilder
ProcessBuilder builder = new ProcessBuilder( "C:\\\"Program Files\"\\Java\\jdk1.6.0_23\\bin\\javac.exe", "\\Path\\To\\MyClass.java" );