From owner-freebsd-java@FreeBSD.ORG Thu Jul 5 14:41:04 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 5708D16A400 for ; Thu, 5 Jul 2007 14:41:04 +0000 (UTC) (envelope-from wvaughan@steelerubber.com) Received: from toaster.steelerubber.com (toaster.steelerubber.com [166.82.96.8]) by mx1.freebsd.org (Postfix) with ESMTP id D790613C465 for ; Thu, 5 Jul 2007 14:41:03 +0000 (UTC) (envelope-from wvaughan@steelerubber.com) Received: (qmail 68130 invoked by uid 89); 5 Jul 2007 14:41:02 -0000 Received: from unknown (HELO ?166.82.96.28?) (166.82.96.28) by toaster.steelerubber.com with SMTP; 5 Jul 2007 14:41:02 -0000 Message-ID: <468D02F7.1010005@steelerubber.com> Date: Thu, 05 Jul 2007 10:40:55 -0400 From: Walter Vaughan User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-java@freebsd.org Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: 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 14:41:04 -0000 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