title: Java system command to load sqlite3 db from file fails
body: <p>I'm trying to use java to run a system command to load a sqlite3 database from a sql file. There is no error in the sql file, it loads ok using the usual method from the command line:</p>
  
  <pre><code>sqlite3 dbname &lt; file.sql
  </code></pre>
  
  <p>My method:</p>
  
  <pre><code>    public void loadSqlFile(String file, boolean tearDown) {
  
      String s = null;
  
      try {
        Process p = Runtime.getRuntime().exec(
          "/usr/bin/sqlite3 " +
            database +
            " &lt; " +
            file
        );
        p.waitFor();
  
        BufferedReader stdInput = new BufferedReader(new
          InputStreamReader(p.getInputStream()));
  
        BufferedReader stdError = new BufferedReader(new
          InputStreamReader(p.getErrorStream()));
  
        // read the output from the command
        System.out.println("Here is the standard output of the command:\n");
        while ((s = stdInput.readLine()) != null) {
          System.out.println(s);
        }
  
        // read any errors from the attempted command
        System.out.println("Here is the standard error of the command (if any):\n");
        while ((s = stdError.readLine()) != null) {
          System.out.println(s);
        }
  
        System.exit(0);
  
      } catch (IOException e) {
        LOGGER.error("Failed to load sql file (" + file + ")");
      } catch (InterruptedException e) {
        LOGGER.error("Failed to load sql file (" + file + ")");
      }
  
    }
  </code></pre>
  
  <p>The command being run translates to:</p>
  
  <pre><code>/usr/bin/sqlite3 /tmp/infinite_state_machine_root/1535223603610/control/database/ism.db &lt; /tmp/ISMCoreActionPack_sqlite3.sql
  </code></pre>
  
  <p>And the error I see on stdout is:</p>
  
  <pre><code>Error: near "&lt;": syntax error
  </code></pre>
  
  <p>I've searched for a lot of examples of running system commands and can't find anything that explains this error, at least to me!</p>
  
  <p>I have tried other commands in there like ps and so on and they seem to run ok.</p>
  
  <p>Any advice?</p>
  
  <p>I'm running this on a MAC if that is significant.</p>