Search code examples
javamacosprintingzebra-printers

ClassCastException printing to a zebra printer on mac os x with java


I had the oddest exception while trying to print to a zebra printer on mac os x with java. I've done this many times in the past and it always worked. Except now on this one machine. I was informed they recently updated their operating system, but I'm not sure that is the cause.

java.lang.ClassCastException: sun.print.UnixPrintService cannot be cast to sun.print.IPPPrintService
    at sun.print.UnixPrintJob.<init>(UnixPrintJob.java:126)
    at sun.print.UnixPrintService.createPrintJob(UnixPrintService.java:467)
  • Mac OS X: 10.14.6
  • Jre: 1.8.0_202

I've found this bug that seems related, but it is on solaris. So I think I'm experiencing something different. JDK-8032227 ClassCastException in UnixPrintJob for ipp printer


Solution

  • Upgrading from Mojave to Catalina solved the problem.