Activity log for bug #155462

Date Who What changed Old value New value Message
2007-10-21 18:02:42 Miguel Costa bug added bug
2007-10-22 13:58:57 Miguel Costa description 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 - 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 show the print dialog 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 - Updated: I can list the printers by using that java code with jre-7 beta, but still can't see any print dialog when i try to print any document with any java application.
2007-10-22 18:51:40 Miguel Costa description 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 show the print dialog 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 - Updated: I can list the printers by using that java code with jre-7 beta, but still can't see any print dialog when i try to print any document with any java application. 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 show the print dialog 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 - Updated: I can list the printers by using that java code with jre-7 beta, but still can't see any print dialog when i try to print any document with any java application. I get only the following output when i try to run this hello world printing function /* * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * -Redistribution of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * -Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of Sun Microsystems, Inc. or the names of contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE * AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY * OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * * You acknowledge that this software is not designed, licensed or intended * for use in the design, construction, operation or maintenance of any * nuclear facility. */ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.print.*; public class HelloWorldPrinter implements Printable, ActionListener { public int print(Graphics g, PageFormat pf, int page) throws PrinterException { if (page > 0) { /* We have only one page, and 'page' is zero-based */ return NO_SUCH_PAGE; } /* User (0,0) is typically outside the imageable area, so we must * translate by the X and Y values in the PageFormat to avoid clipping */ Graphics2D g2d = (Graphics2D)g; g2d.translate(pf.getImageableX(), pf.getImageableY()); /* Now we perform our rendering */ g.drawString("Hello world!", 100, 100); /* tell the caller that this page is part of the printed document */ return PAGE_EXISTS; } public void actionPerformed(ActionEvent e) { PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(this); boolean ok = job.printDialog(); if (ok) { try { job.print(); } catch (PrinterException ex) { /* The job did not successfully complete */ } } } public static void main(String args[]) { UIManager.put("swing.boldMetal", Boolean.FALSE); JFrame f = new JFrame("Hello World Printer"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} }); JButton printButton = new JButton("Print Hello World"); printButton.addActionListener(new HelloWorldPrinter()); f.add("Center", printButton); f.pack(); f.setVisible(true); } And the Output java.lang.NullPointerException: null attribute at sun.print.IPPPrintService.isAttributeValueSupported(IPPPrintService.java:1147) at sun.print.ServiceDialog$OrientationPanel.updateInfo(ServiceDialog.java:2121) at sun.print.ServiceDialog$PageSetupPanel.updateInfo(ServiceDialog.java:1263) at sun.print.ServiceDialog.updatePanels(ServiceDialog.java:437) at sun.print.ServiceDialog.initPrintDialog(ServiceDialog.java:195) at sun.print.ServiceDialog.<init>(ServiceDialog.java:124) at javax.print.ServiceUI.printDialog(ServiceUI.java:188) at sun.print.RasterPrinterJob.printDialog(RasterPrinterJob.java:855) at sun.print.PSPrinterJob.printDialog(PSPrinterJob.java:421)
2007-10-22 18:51:40 Miguel Costa name seyon
2007-10-22 22:41:22 Miguel Costa description 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 show the print dialog 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 - Updated: I can list the printers by using that java code with jre-7 beta, but still can't see any print dialog when i try to print any document with any java application. I get only the following output when i try to run this hello world printing function /* * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * -Redistribution of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * -Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of Sun Microsystems, Inc. or the names of contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE * AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY * OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * * You acknowledge that this software is not designed, licensed or intended * for use in the design, construction, operation or maintenance of any * nuclear facility. */ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.print.*; public class HelloWorldPrinter implements Printable, ActionListener { public int print(Graphics g, PageFormat pf, int page) throws PrinterException { if (page > 0) { /* We have only one page, and 'page' is zero-based */ return NO_SUCH_PAGE; } /* User (0,0) is typically outside the imageable area, so we must * translate by the X and Y values in the PageFormat to avoid clipping */ Graphics2D g2d = (Graphics2D)g; g2d.translate(pf.getImageableX(), pf.getImageableY()); /* Now we perform our rendering */ g.drawString("Hello world!", 100, 100); /* tell the caller that this page is part of the printed document */ return PAGE_EXISTS; } public void actionPerformed(ActionEvent e) { PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(this); boolean ok = job.printDialog(); if (ok) { try { job.print(); } catch (PrinterException ex) { /* The job did not successfully complete */ } } } public static void main(String args[]) { UIManager.put("swing.boldMetal", Boolean.FALSE); JFrame f = new JFrame("Hello World Printer"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} }); JButton printButton = new JButton("Print Hello World"); printButton.addActionListener(new HelloWorldPrinter()); f.add("Center", printButton); f.pack(); f.setVisible(true); } And the Output java.lang.NullPointerException: null attribute at sun.print.IPPPrintService.isAttributeValueSupported(IPPPrintService.java:1147) at sun.print.ServiceDialog$OrientationPanel.updateInfo(ServiceDialog.java:2121) at sun.print.ServiceDialog$PageSetupPanel.updateInfo(ServiceDialog.java:1263) at sun.print.ServiceDialog.updatePanels(ServiceDialog.java:437) at sun.print.ServiceDialog.initPrintDialog(ServiceDialog.java:195) at sun.print.ServiceDialog.<init>(ServiceDialog.java:124) at javax.print.ServiceUI.printDialog(ServiceUI.java:188) at sun.print.RasterPrinterJob.printDialog(RasterPrinterJob.java:855) at sun.print.PSPrinterJob.printDialog(PSPrinterJob.java:421) 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 show the print dialog 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 - Updated: I can list the printers by using that java code with jre-7 beta, but still can't see any print dialog when i try to print any document with any java application. I get only the following output when i try to run this hello world printing function /* * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * -Redistribution of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * -Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of Sun Microsystems, Inc. or the names of contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE * AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY * OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * * You acknowledge that this software is not designed, licensed or intended * for use in the design, construction, operation or maintenance of any * nuclear facility. */ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.print.*; public class HelloWorldPrinter implements Printable, ActionListener { public int print(Graphics g, PageFormat pf, int page) throws PrinterException { if (page > 0) { /* We have only one page, and 'page' is zero-based */ return NO_SUCH_PAGE; } /* User (0,0) is typically outside the imageable area, so we must * translate by the X and Y values in the PageFormat to avoid clipping */ Graphics2D g2d = (Graphics2D)g; g2d.translate(pf.getImageableX(), pf.getImageableY()); /* Now we perform our rendering */ g.drawString("Hello world!", 100, 100); /* tell the caller that this page is part of the printed document */ return PAGE_EXISTS; } public void actionPerformed(ActionEvent e) { PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(this); boolean ok = job.printDialog(); if (ok) { try { job.print(); } catch (PrinterException ex) { /* The job did not successfully complete */ } } } public static void main(String args[]) { UIManager.put("swing.boldMetal", Boolean.FALSE); JFrame f = new JFrame("Hello World Printer"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} }); JButton printButton = new JButton("Print Hello World"); printButton.addActionListener(new HelloWorldPrinter()); f.add("Center", printButton); f.pack(); f.setVisible(true); } } And the Output java.lang.NullPointerException: null attribute at sun.print.IPPPrintService.isAttributeValueSupported(IPPPrintService.java:1147) at sun.print.ServiceDialog$OrientationPanel.updateInfo(ServiceDialog.java:2121) at sun.print.ServiceDialog$PageSetupPanel.updateInfo(ServiceDialog.java:1263) at sun.print.ServiceDialog.updatePanels(ServiceDialog.java:437) at sun.print.ServiceDialog.initPrintDialog(ServiceDialog.java:195) at sun.print.ServiceDialog.<init>(ServiceDialog.java:124) at javax.print.ServiceUI.printDialog(ServiceUI.java:188) at sun.print.RasterPrinterJob.printDialog(RasterPrinterJob.java:855) at sun.print.PSPrinterJob.printDialog(PSPrinterJob.java:421)
2007-10-22 23:12:07 Miguel Costa description 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 show the print dialog 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 - Updated: I can list the printers by using that java code with jre-7 beta, but still can't see any print dialog when i try to print any document with any java application. I get only the following output when i try to run this hello world printing function /* * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * -Redistribution of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * -Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of Sun Microsystems, Inc. or the names of contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE * AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY * OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * * You acknowledge that this software is not designed, licensed or intended * for use in the design, construction, operation or maintenance of any * nuclear facility. */ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.print.*; public class HelloWorldPrinter implements Printable, ActionListener { public int print(Graphics g, PageFormat pf, int page) throws PrinterException { if (page > 0) { /* We have only one page, and 'page' is zero-based */ return NO_SUCH_PAGE; } /* User (0,0) is typically outside the imageable area, so we must * translate by the X and Y values in the PageFormat to avoid clipping */ Graphics2D g2d = (Graphics2D)g; g2d.translate(pf.getImageableX(), pf.getImageableY()); /* Now we perform our rendering */ g.drawString("Hello world!", 100, 100); /* tell the caller that this page is part of the printed document */ return PAGE_EXISTS; } public void actionPerformed(ActionEvent e) { PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(this); boolean ok = job.printDialog(); if (ok) { try { job.print(); } catch (PrinterException ex) { /* The job did not successfully complete */ } } } public static void main(String args[]) { UIManager.put("swing.boldMetal", Boolean.FALSE); JFrame f = new JFrame("Hello World Printer"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} }); JButton printButton = new JButton("Print Hello World"); printButton.addActionListener(new HelloWorldPrinter()); f.add("Center", printButton); f.pack(); f.setVisible(true); } } And the Output java.lang.NullPointerException: null attribute at sun.print.IPPPrintService.isAttributeValueSupported(IPPPrintService.java:1147) at sun.print.ServiceDialog$OrientationPanel.updateInfo(ServiceDialog.java:2121) at sun.print.ServiceDialog$PageSetupPanel.updateInfo(ServiceDialog.java:1263) at sun.print.ServiceDialog.updatePanels(ServiceDialog.java:437) at sun.print.ServiceDialog.initPrintDialog(ServiceDialog.java:195) at sun.print.ServiceDialog.<init>(ServiceDialog.java:124) at javax.print.ServiceUI.printDialog(ServiceUI.java:188) at sun.print.RasterPrinterJob.printDialog(RasterPrinterJob.java:855) at sun.print.PSPrinterJob.printDialog(PSPrinterJob.java:421) 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 show the print dialog 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 - Updated: I can list the printers by using that java code with jre-7 beta, but still can't see any print dialog when i try to print any document with any java application. I get only the following output when i try to run this hello world printing function /* * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * -Redistribution of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * -Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of Sun Microsystems, Inc. or the names of contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE * AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY * OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * * You acknowledge that this software is not designed, licensed or intended * for use in the design, construction, operation or maintenance of any * nuclear facility. */ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.print.*; public class HelloWorldPrinter implements Printable, ActionListener { public int print(Graphics g, PageFormat pf, int page) throws PrinterException { if (page > 0) { /* We have only one page, and 'page' is zero-based */ return NO_SUCH_PAGE; } /* User (0,0) is typically outside the imageable area, so we must * translate by the X and Y values in the PageFormat to avoid clipping */ Graphics2D g2d = (Graphics2D)g; g2d.translate(pf.getImageableX(), pf.getImageableY()); /* Now we perform our rendering */ g.drawString("Hello world!", 100, 100); /* tell the caller that this page is part of the printed document */ return PAGE_EXISTS; } public void actionPerformed(ActionEvent e) { PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(this); boolean ok = job.printDialog(); if (ok) { try { job.print(); } catch (PrinterException ex) { /* The job did not successfully complete */ } } } public static void main(String args[]) { UIManager.put("swing.boldMetal", Boolean.FALSE); JFrame f = new JFrame("Hello World Printer"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} }); JButton printButton = new JButton("Print Hello World"); printButton.addActionListener(new HelloWorldPrinter()); f.add("Center", printButton); f.pack(); f.setVisible(true); } } And the Output java.lang.NullPointerException: null attribute at sun.print.IPPPrintService.isAttributeValueSupported(IPPPrintService.java:1147) at sun.print.ServiceDialog$OrientationPanel.updateInfo(ServiceDialog.java:2121) at sun.print.ServiceDialog$PageSetupPanel.updateInfo(ServiceDialog.java:1263) at sun.print.ServiceDialog.updatePanels(ServiceDialog.java:437) at sun.print.ServiceDialog.initPrintDialog(ServiceDialog.java:195) at sun.print.ServiceDialog.<init>(ServiceDialog.java:124) at javax.print.ServiceUI.printDialog(ServiceUI.java:188) at sun.print.RasterPrinterJob.printDialog(RasterPrinterJob.java:855) at sun.print.PSPrinterJob.printDialog(PSPrinterJob.java:421) With cupsys 1.2.8-0ubuntu8 i can print without problems
2007-10-28 15:15:41 arno_b marked as duplicate 156191
2007-11-12 00:37:24 Yan Li bug assigned to sun-java6 (Ubuntu)
2010-11-26 14:07:51 Martin Wildam bug added subscriber Martin Wildam