Java Print Service: PrintServiceLookup.lookupPrintServices does not return networked printers

java, printing, service, windows

Solution

You have to run the windows service as a user on the domain that has the appropriate permissions, not as LocalUser.

You can also add networked printers using a tcp/ip connection, and the problem goes away.

Problem

If I run my JBoss application from the Windows command prompt I can get the list of printers (including networked printers just fine). If I run my JBoss application as a Windows service, I only get the list of printers that are directly connected to the machine. The networked printers don't show up. Here is the Java code I use to get the list of printers: ``` PrintService[] printerServices = PrintServiceLookup.lookupPrintServices(null, null); ``` It doesn't appear to be a permissions problem, since according to our administrator, the permissions are setup just fine. Does some have a better explanation, or is there a set of permissions that might be required to get the networked printers to show up?

Original source