title: Disconnect java application from console/command window
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/264687/is-there-a-way-to-the-hide-win32-launch-console-from-a-java-program-if-possible">Is there a way to the hide win32 launch console from a Java program (if possible without JNI)</a>  </p>
  </blockquote>
  
  <p>When I run my java swing application in a batch file on windows, the console/command window remains open whilst my java application is running. This creates an extra window on my taskbar which I would prefer not to have. But when I close the command window it stops my java application. Is there a way, perhaps via the batch file or command line parameters or code changes to my application, to have java.exe exit after bringing up my swing app and the console window close whilst my application still runs?</p>
  
  <p>Main method is as follows:</p>
  
  <pre><code>public static void main(String args[]) {
  
      ApplContext applContext = new ApplContext();
      Throwable error = null;
  
      try {
          applContext.setUserConfigDir(args.length&gt;0 ? args[0] : null);
          applContext.loadData();
          ApplTools.initLookAndFeel(Parameters.P_NIMBUS_LAF.of(applContext.getParameters()));
      } catch (Throwable e) {
          error = e;
      }
  
      // JWorkSheet is a JFrame.
      new JWorkSheet(applContext, error).setVisible();
  }    
  </code></pre>