1 Reply Latest reply on Jul 23, 2013 2:53 PM by user6481339

    Java Web Start PrinterJob not working


      I have a JavaFX application that uses a AWT PrinterJob to print the contents of a table. Everything is working fine while on development and when I run the application locally but when I sing it and distribute it via Web start, the print dialog box doesn't open and the application crashes.

      From my research I found that I could use the PrintServices of the JNLP API but I also saw that from Java 5.0 onwards you don't have too. I tried it anyway but I get worst results as I can't make it run even locally. I know for a fact that it could work because I do the same thing for another Java application I discribute using Web Start and have no problems there. The difference in this application is that it is a JavaFX application and the working one is a Swing one if that gives you any clues.

      Below is the function I use to create the PrinterJob and print my Printable class


          public void printToImage() {

              for (CompactResult cr : getResDataList()) {



              CompactResultPrinter p = new CompactResultPrinter(getPrintDataList(), getResourceBoundle(),

                      getFrom(), getTo(), getFinalSearchList());


               * Code below works on development


              PrinterJob job = PrinterJob.getPrinterJob();

              PageFormat pf = job.defaultPage();


              Paper paper = new Paper();

              paper.setImageableArea(0, 0, paper.getWidth(), paper.getHeight());


              job.setPrintable(p, pf);

              boolean ok = job.printDialog();

              if (ok) {

                  try {


                  } catch (PrinterException ex) {







      Below I include the output I get in Java Console.

      Caused by: java.lang.NullPointerException

      at javax.print.PrintServiceLookup.getServicesForContext(Unknown Source)

      at javax.print.PrintServiceLookup.getListOfLookupServices(Unknown Source)

      at javax.print.PrintServiceLookup.getAllLookupServices(Unknown Source)

      at javax.print.PrintServiceLookup.lookupDefaultPrintService(Unknown Source)

      at sun.print.Win32PrintServiceLookup.getWin32PrintLUS(Unknown Source)

      at sun.awt.windows.WPrinterJob.getPrintService(Unknown Source)

      at sun.print.RasterPrinterJob.setPrintable(Unknown Source)

      at AdvancedSearchDetailedResultsTableViewController.printToImage(AdvancedSearchDetai..


      Any clues?