title: java runtime.getRuntime.exec( cmd ) with long parameters
body: <p>I'm making a frontend for a command line app. It has a very long  The command line is something simliar to this:</p>
  
  <pre><code>public String liveShellCommand(){
  
    String cmd="command mode --parameter arg --parameter2 arg2 --parameter3 arg3";
  
    Runtime run = Runtime.getRuntime() ;
    Process pr ;
      try {
         log.progress("sending command: " +cmd);       
         pr = run.exec( cmd );
         pr.waitFor() ;
  </code></pre>
  
  <p>Everything seems to work until I add the "mode" switch into it.  The "mode" switch executes from the command line.  I've tried a few combinations splitting the parameters into an array which does not execute either.  I think it has something to do with "mode" not having a -- in front of it, and it cannot have a -- in front of it.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>edit: I forgot to mention that all I can see is this:  Debugger stopped on uncompilable source code.  I'm using netbeans and it does not seem to print out a stack trace.   It stops on the run.exec(cmd).   Is there something wrong with java?</p>
  
  <p>I was able to use the ProcessBuilder in order to run it without just simply failing...</p>
  
  <p>It parses "command" just fine, but when I add "command mode"</p>
  
  <pre><code> java.io.IOException: Cannot run program "command mode": java.io.IOException: error=2, No such file or directory
  </code></pre>
  
  <p>So it can't parse that I guess.   </p>