Date: Thu, 05 Jul 2007 10:40:55 -0400 From: Walter Vaughan <wvaughan@steelerubber.com> To: freebsd-java@freebsd.org Subject: Finding Printers Message-ID: <468D02F7.1010005@steelerubber.com>
next in thread | raw e-mail | index | archive | help
Can someone test this code on their box? No matter how I try I cannot install a printer such that the JavaVM can find it. If it does work, could you report what java version you used (diablo, ports) and what version of 6 or 7, and how you installed the printer? import javax.print.*; import javax.print.attribute.*; import javax.print.attribute.standard.*; public class ListPrinters { public static void main(String[] args) { String sPrinterName = null; PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null); for (int i = 0; i < services.length; i++) { PrintServiceAttribute attr = services[i].getAttribute(PrinterName.class); sPrinterName = ((PrinterName)attr).getValue(); System.out.println("Found printer: " + sPrinterName + "\n"); } System.out.println("Finshed\n"); } } The above code runs fine on sunJDK on Ubunutu box :( which means production will have to be Ubuntu unless I can figure it out how to get the Java vm to recognize installed printers. Thanks for any help. -- Walter
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?468D02F7.1010005>