In this same IDE eclipse i have two projects both have
ProcessBuilder builder = new ProcessBuilder("cmd.exe", "/c", "command");
but in project one it is not showing compile error but in project two it is showing compile error both JRE System Library is jre1.8.0_31
The compile error is the subject-heading of this post ie.
The constructor ProcessBuilder(String, String, String) is undefined
please help?
For me in eclipse I right clicked on my project; went to properties; chose java compiler; My compliance level was stuck at 1.4; so I bumped it up to the latest - 1.8 & it worked after that.
I had this exact same error. I'm running eclipse in Ubuntu. My line of code with the error was
ProcessBuilder builder2 = new ProcessBuilder("cmd.exe", "/c", "rasphone -h irid");
My solution was similar to Reece's. Except my compliance level was at 1.7 (and there was no 1.8)
But I went to 1.5, and for some reason that worked. Weird.
Try this.
String[] commands ={"cmd.exe", "/c", "command"};
ProcessBuilder processBuilder = new ProcessBuilder(commands);