title: Too many command-line arguments when calling pg_dump from java
body: <p>After running into an issue on executing some queries as strings in Java for postgres, I went using string arrays, which solved my existing issues.</p>
  
  <p>After the switch I am now having an issue with <code>pg_dump</code>, but not with <code>pg_restore</code>.</p>
  
  <p>When I supply my method with the following array:</p>
  
  <pre><code>[time, ./pg_dump, -U, lehigh, -d, lehigh, -Fc, data/completedDb.dump]
  </code></pre>
  
  <p>I get the following error:</p>
  
  <blockquote>
    <p>pg_dump: too many command-line arguments (first is
    "data/completedDb.dump")</p>
  </blockquote>
  
  <p>ProcessBuilder produces the following for my execution:</p>
  
  <pre><code>time ./pg_dump -U lehigh -d lehigh -Fc data/completedDb.dump
  </code></pre>
  
  <p>And it works fine when I add the output arrow, and remove the data folder, on the command line.</p>
  
  <pre><code>time ./pg_dump -U lehigh -d lehigh -Fc &gt; completedDb.dump
  </code></pre>
  
  <p>I'm running this through eclipse, in Java on a postgres database, using :</p>
  
  <pre><code> Runtime.getRuntime().exec();
  </code></pre>
  
  <p>I've tried using <code>Process.start()</code> but got the same errors, so I'm totally dumbfounded at what I'm doing wrong.</p>
  
  <p>Prior to this change, <code>pg_dump</code> was being executed properly as a single string. I don't want to go back to that method as I want to maintain consistency, but I also want to figure out what I'm doing wrong here.</p>