From owner-freebsd-java@FreeBSD.ORG Thu Jul 5 15:16:47 2007 Return-Path: X-Original-To: freebsd-java@freebsd.org Delivered-To: freebsd-java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 74A5716A400 for ; Thu, 5 Jul 2007 15:16:47 +0000 (UTC) (envelope-from ronald-freebsd8@klop.yi.org) Received: from smtp-out0.tiscali.nl (smtp-out0.tiscali.nl [195.241.79.175]) by mx1.freebsd.org (Postfix) with ESMTP id 3CE2113C4B0 for ; Thu, 5 Jul 2007 15:16:46 +0000 (UTC) (envelope-from ronald-freebsd8@klop.yi.org) Received: from [82.171.39.195] (helo=guido.klop.ws) by smtp-out0.tiscali.nl with smtp (Tiscali http://www.tiscali.nl) id 1I6T4X-0003Vg-SU for ; Thu, 05 Jul 2007 17:16:45 +0200 Received: (qmail 3099 invoked from network); 5 Jul 2007 15:16:40 -0000 Received: from localhost.thuis.klop.ws (HELO guido.klop.ws) (127.0.0.1) by localhost.thuis.klop.ws with SMTP; 5 Jul 2007 15:16:40 -0000 Date: Thu, 05 Jul 2007 17:16:39 +0200 To: freebsd-java@freebsd.org From: "Ronald Klop" Content-Type: text/plain; format=flowed; delsp=yes; charset=us-ascii MIME-Version: 1.0 References: <468D02F7.1010005@steelerubber.com> Content-Transfer-Encoding: Quoted-Printable Message-ID: In-Reply-To: <468D02F7.1010005@steelerubber.com> User-Agent: Opera Mail/9.21 (FreeBSD) Subject: Re: Finding Printers X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2007 15:16:47 -0000 On Thu, 05 Jul 2007 16:40:55 +0200, Walter Vaughan = 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