Problem to print in JAVA Application in Linux
Hayarobi Park
hayarobipark at gmail.com
Tue Aug 26 19:02:12 PDT 2008
I am unable to print in JAVA based applications after upgrading cups to 1.3.7.
I tested with the code below:
===========================================
import java.awt.print.PrinterJob;
class DummyPrinter {
public static void main(String[] args) {
try {
PrinterJob printJob=PrinterJob.getPrinterJob();
printJob.printDialog();
System.exit(0);
} catch( Exception e) {
e.printStackTrace();
}
}
}
============================================
The result was this:
hayarobipark at linux ~ $ java DummyPrinter
java.lang.NullPointerException: null attribute
at sun.print.IPPPrintService.isAttributeValueSupported(IPPPrintService.java:1100)
at sun.print.ServiceDialog$OrientationPanel.updateInfo(ServiceDialog.java:2092)
at sun.print.ServiceDialog$PageSetupPanel.updateInfo(ServiceDialog.java:1234)
at sun.print.ServiceDialog.updatePanels(ServiceDialog.java:428)
at sun.print.ServiceDialog.initPrintDialog(ServiceDialog.java:193)
at sun.print.ServiceDialog.(ServiceDialog.java:141)
at javax.print.ServiceUI.printDialog(ServiceUI.java:180)
at sun.print.RasterPrinterJob.printDialog(RasterPrinterJob.java:853)
at sun.print.PSPrinterJob.printDialog(PSPrinterJob.java:418)
at DummyPrinter.main(test.java:7)
The result above was on case of sun jdk 1.5, and on 1.6 was the same but line number:
hayarobipark at linux ~ $ java DummyPrinter
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)
...
On jdk 1.4, I could see print dialog.
I downgraded cups to 1.2.12, and the printing works fine.
My linux is gentoo with kernel 2.6.25-gentoo-r7, and JDKs are sun-jdk-1.4.2.17, sun-jdk-1.5.0.16 and sun-jdk-1.6.0.07. I've tested that code in Ubuntu Hardy, and the result was same.
More information about the cups
mailing list