Date: Thu, 05 Jul 2007 17:16:39 +0200 From: "Ronald Klop" <ronald-freebsd8@klop.yi.org> To: freebsd-java@freebsd.org Subject: Re: Finding Printers Message-ID: <op.tuzzd1gy8527sy@guido.klop.ws> In-Reply-To: <468D02F7.1010005@steelerubber.com> References: <468D02F7.1010005@steelerubber.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 05 Jul 2007 16:40:55 +0200, Walter Vaughan = <wvaughan@steelerubber.com> wrote: > Can someone test this code on their box? > > No matter how I try I cannot install a printer such that the JavaVM ca= n = > 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 =3D null; > PrintService[] services =3D > PrintServiceLookup.lookupPrintServices(null, null); > for (int i =3D 0; i < services.length; i++) { > PrintServiceAttribute attr =3D > services[i].getAttribute(PrinterName.class); > sPrinterName =3D ((PrinterName)attr).getValu= e(); > 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 ge= t = > the Java vm to recognize installed printers. > > Thanks for any help. > > -- > Walter > _______________________________________________ > freebsd-java@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-java > To unsubscribe, send any mail to "freebsd-java-unsubscribe@freebsd.org= " It works for me. I found 2 printers and I have 2 printers installed. I'm using a recent CUPS on a recent FreeBSD 6.x-STABLE (i386) with a = recent diablo-jdk. -- = Ronald Klop Amsterdam, The Netherlands
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?op.tuzzd1gy8527sy>