Java - how to run my application completely silently without any GUI or Command prompt popup?
<p>I wrote this printing application, which is launched from Python27 on Windows 8.1 64-bit. My problem is that its a Kiosk in public location, when Python27 launch the Java then it has a windows command prompt with close icon  (some users click the close icon on command prompt and job does not get completed)</p>

<p>Question: How to run this following code silently without any command prompt being exposed/popup in Kiosk?</p>

<pre><code>import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import javax.print.DocPrintJob;
import javax.print.PrintService;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.printing.PDFPageable;

public class JPrint {

  public static boolean saveFile(URL url, String file) throws IOException {
    boolean download_status = false;

    System.out.println("[OK] - 1");
    InputStream in = url.openStream();
    FileOutputStream fos = new FileOutputStream(new File(file));
    System.out.println("[OK] - 2");
    int length = -1;
    byte[] buffer = new byte[1024];

    while ((length = in.read(buffer)) &gt; -1) {
        fos.write(buffer, 0, length);
    }
    fos.close();
    in.close();

    download_status = true;
    System.out.println("[OK] - 3");
    return download_status;
  }

  public static void main(String[] args) throws IOException, PrinterException {  
    String downloaded_filename = "C:/pdf.pdf";
    String download_pdf_from = "http://www.example.com/index/print?kiosk=1";
    String downloaded_filename_open_as_pdf = "C:\\pdf.pdf";
    String printerNameDesired = "HP Photosmart 5520 series"; 

    // Get printers
    PrintService[] services = PrinterJob.lookupPrintServices();
    DocPrintJob docPrintJob = null;
          for (int i = 0; i &lt; services.length; i++) {
            System.out.println(services[i]);
          }   

    try{
      URL url = new URL(download_pdf_from);

      if(saveFile(url, downloaded_filename)) {
        try {
          PDDocument pdf = PDDocument.load(new File(downloaded_filename_open_as_pdf));
          PrinterJob job = PrinterJob.getPrinterJob();
          for (int i = 0; i &lt; services.length; i++) {
           if (services[i].getName().equalsIgnoreCase(printerNameDesired)) {
             docPrintJob = services[i].createPrintJob();
           }
          }

          job.setPrintService(docPrintJob.getPrintService());
          job.setPageable(new PDFPageable(pdf));
          //docPrintJob = service[i].createPrintJob();
          job.print();

        } catch (Exception e) {
          System.out.println("[FAIL]" + e);
        }      
      } else {
        System.out.println("[FAIL] - download fail");
      }      
    } catch (Exception ae) {
      System.out.println("[FAIL]" + ae);
    }


  }
}
</code></pre>