title: SQLite executing .import cmd from Java
body: <p>I want to use the sqlite3 shell command .import to load a tab separated file into my database. </p>
  
  <p>Executing the command from shell is no problem! </p>
  
  <p>Writing a shell script including the command and running it from Java is no problem!</p>
  
  <pre><code>#! /bin/bash
  # Script for loading a specific file ($1) into a SQLite DBS table ($2)
  {
      sqlite3 database.db -cmd ".mode tab" -cmd ".import $1 $2" -cmd ".quit" &amp;
  } 2&gt; /dev/null
  exit 0
  </code></pre>
  
  <p><strong>But how do I execute the command directly from Java?</strong>
  Here is what I've tried: But somehow nothing is loaded into the database</p>
  
  <pre><code>String[] cmd={"sqlite3","database.db -cmd \".mode tab\" -cmd \".import\" "+file.getPath()+" "+table+" -cmd \".quit\""};
  Runtime.getRuntime().exec(cmd);
  </code></pre>