I use javax.print.PrintService to look up printer services on local machine. Here is code to get printers:
PrintService[] services = PrintServiceLookup.lookupPrintServices(DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
Can i al开发者_JS百科so get port name of printer (USB001, COM, LPT..) in java?
You just can't do it with pure Java code (i.e., without using JNI (native code)).
精彩评论