I'm running RHEL 6.4 and trying to use Java to lookup print services:
PrinterService[] services = PrinterJob.lookupPrintServices();
This works great in Java 7. It returns the default printer on my system.
When I run the same thing in Java 8, I get null.
I also tried:
PrintService service = PrintServiceLookup.lookupDefaultPrintService();
Again, in Java 7, it returns my default printer. In Java 8, it returns null.
I then tried using the following lookup command:
PrinterService[] services = PrinterServiceLookup.lookupPrintServices(null, null);
Again, in Java 7, this returns my default printer.
In Java 8, it actually returns the same printer (i.e. same printer name), but when I run getSupportedDocFlavors() on the returned PrintService, it's null. Because of this, I get an exception while trying to print:
java.awt.print.PrinterException: Not a 2D print service: IPP Printer : printer
I would really like to know how I can get Java 8 to recognize my printer the same way that Java 7 does.
Another detail: If I ssh to my printer server and open up /etc/cups/client.conf, and change ServerName to "localhost" (instead of the printer server IP), then Java 8 finds it. So it seems like Java 8 is having trouble finding it over the network.
Does anybody have any ideas on how to solve this?
Thanks,
John