title: Database restoring with java code - program not responding
body: <p>I'm trying to restore a backed up .sql file using Java program. I'm posting the method below. But when I execute this the program halts for a long time. Then I executed same mysql command in command line(Windows) it's works charmingly.</p>
  
  <p>Puzzled where I missed. What do you think ? </p>
  
  <pre><code>            File file;
           final JFileChooser fc = new JFileChooser();
           int returnVal = fc.showOpenDialog(this);
  
     if (returnVal == JFileChooser.APPROVE_OPTION) {
                   file = fc.getSelectedFile();
  
           try {
               System.out.println(file.getCanonicalPath());
  
          String executeCmd = "mysql -u " + username + " -p" + password +" " + dbName+" &lt; "+" \" "+file.getCanonicalPath()+"\" " ;
           Process runtimeProcess;
             runtimeProcess = Runtime.getRuntime().exec(executeCmd);
           int processComplete = runtimeProcess.waitFor();
           if (processComplete == 0) {
  
              JOptionPane.showMessageDialog(Interface.mainFrame, "Database Backup restored successfully.", "Netmetering", 1);     
          } else {
              System.out.println("Could not restore the backup");
          }
      } catch (IOException | InterruptedException ex) {}
  </code></pre>
  
  <p>...</p>