Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8169620

Java incorrectly reports no print services found

XMLWordPrintable

    • 2d
    • x86
    • os_x

      FULL PRODUCT VERSION :
      java version "1.8.0_101"

      ADDITIONAL OS VERSION INFORMATION :
      macOS Sierra 10.12

      A DESCRIPTION OF THE PROBLEM :
      When first attempting to print from MATLAB on Sierra, a dialog appears saying
      "There are no properly configured printers on the system". After opening the Printers & Scanners panel in System Preferences, MATLAB is now able to find the configured printers.

      This is also reproducible using the attached Java code.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      javac TestPrintServiceLookup.java
      java TestPrintServiceLookup

      This may be more likely to reproduce immediately after a reboot, before opening the Printers preferences or successfully printing from another application.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      PrintServices found: 1
      (or more)

      ACTUAL -
      PrintServices found: 0

      REPRODUCIBILITY :
      This bug can be reproduced occasionally.

      ---------- BEGIN SOURCE ----------
      import java.awt.print.Printable;
      import java.awt.print.PrinterException;
      import java.awt.print.PrinterJob;
      import javax.print.PrintService;
      import javax.print.PrintServiceLookup;

      public class TestPrintServiceLookup {

          public static void main(String[] args) {
              PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null,null);

              System.out.println("PrintServices found: " + printServices.length);
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      After opening the Printers & Scanners panel in System Preferences, MATLAB is now able to find the configured printers.

            prr Philip Race
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: