Comment 0 for bug 155462

Revision history for this message
Miguel Costa (seyon) wrote :

This applies to a current Gutsy Gibbon amd64 installation
I have installed Java 1.5 from the repositories

Printing from any java application (e.g. Netbeans, Jedit) to a CUPS printer does not work
by compiling and running the following code i can't get any printers listed.

import javax.print.PrintService; import javax.print.attribute.Attribute; import javax.print.attribute.standard.PrinterIsAcceptingJobs; /* * * TestPrinter.java * * * * Created on 26 de Setembro de 2007, 14:52 * * * * To change this template, choose Tools | Template Manager * * and open the template in the editor. * */ /** * * * * @author carlos * */ public class TestPrinter { /** Creates a new instance of TestPrinter */ public TestPrinter() { } public static boolean checkAvailablePrinters() { PrintService[] ss = java.awt.print.PrinterJob.lookupPrintServices(); for (int i=0;i<ss.length;i++) { System.out.println( ss[i].getName() + "\n " + ss[i] ); Attribute[] att = ss[i].getAttributes().toArray(); for (int j=0;j<att.length;j++) { if (att[j].equals( PrinterIsAcceptingJobs.ACCEPTING_JOBS ) ) { System.out.println( "ACCEPTING JOBS" ); } } } return false; } public static void main( String[] args ) { checkAvailablePrinters(); } }

by running the following command, the printers are listed

seyon@XK0:~$ lpstat -t
programador em execução
destino predefinido de sistema: XKPrinter
periférico para XKPrinter: usb://HP/LaserJet%201022
periférico para XKPrinter_Cores: usb://EPSON/Stylus%20CX3600
periférico para XKPrinter_PDF: cups-pdf:/
XKPrinter aceita pedidos desde Dom 21 Out 2007 18:46:10 WEST
XKPrinter_Cores aceita pedidos desde Sáb 20 Out 2007 23:44:10 WEST
XKPrinter_PDF aceita pedidos desde Sáb 28 Abr 2007 19:41:52 WEST
impressora XKPrinter inactiva. activada desde Dom 21 Out 2007 18:46:10 WEST
impressora XKPrinter_Cores desactivada desde Sáb 20 Out 2007 23:44:10 WEST -