Printing issues with Java on Linux
February 21, 2008 at 1:52 pm | In Thoughts | 11 CommentsTags: bug, cups, java, Linux, printing, ubuntu
Recently I’ve started using a number of open source applications to help me manage a couple of projects. In particular one of the most useful has been FreeMind, which I’ve written about before. An issue that has been bothering me is that I’ve been unable to print the maps. For reference I’m running Ubuntu Linux with the official Java SDK version 1.6.0_03.
Looking further into issue I noticed the following error being printed to the console when I clicked on the print menu item (I’ve trimmed the stack trace down to the essential few lines):
WARNING: [uncaughtException]java.lang.NullPointerException: null attribute
java.lang.NullPointerException: null attribute
at sun.print.IPPPrintService.isAttributeValueSupported(IPPPrintService.java:1147)
I found this bug report on the bugs.sun.com website which revealed that this is a known issue when printing under Linux. I followed this link in one of the comments by KMTracey to a bug report in the Launchpad bug tracking system which had a workaround.
The detailed steps of the workaround are:
- Click on the System menu item on the main panel (typically located at the top of the screen)
- Click on the Administration menu item
- Click on the Printing menu item
- Change the job options for each printer by:
- Click on the name of the printer in the list
- Click the Job Options tab
- Select the Portrait option in the Orientation drop down list
- Click the Apply button
- Repeat steps 4.1 – 4.4 for each printer in your list
- Close the Printer configuration window
I hope this workaround proves useful to other people experiencing this issue, and many thanks to those that have contributed to the bug reports before me which allowed me to find the solution.
Photo of the bug downloaded from the Image*After website and found using the everystockphoto search engine.
11 Comments
Sorry, the comment form is closed at this time.
Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.




Ta, that helped.
Comment by Ian Hawkins — February 22, 2008 #
Thanks!!!! The printing problem had been keeping me from using some software I had purchased. This fixed the problem and now I can start using the program! Thanks again for this excellent piece of advice!
Russ
Comment by Russ — February 29, 2008 #
[...] first issue is with printing, but the workaround I’ve written about before fixed it for me. The second issue was a display issue that I’ve also written about [...]
Pingback by Migrating to the Hardy Heron « Tech Explorer — March 26, 2008 #
Thanks for the fix. Printing from Java applications was a bit of annoyance. I have seen fixes where people would install CUPS from Fiesty Fawn into Gutsy. This makes more sense although I wonder why this could not be addressed by Sun or Ubuntu team. This is a known issue for a long time.
Tomo
Comment by Tomo Popovic — April 5, 2008 #
@Tomo,
I don’t know why it the Java issue hasn’t been addressed by Sun. I also don’t know why the other issue, Java working with Compiz, hasn’t been resolved either.
I do think though that these aren’t Linux / CUPS / Compiz issues but rather Sun issues. After all it isn’t unreasonable, from the point of view of CUPS for example to expect an application to control page orientation defaults, rather than relying on a setting in CUPS.
If nothing else the Java code should handle the error gracefully when it doesn’t get a parameter it expects, rather than throwing an unresolved exception.
Comment by techxplorer — April 6, 2008 #
Thank you for the workaround. I changed printing job options to landscape and pageDialog and printDialog worked. Then I changed back to portrait orientation. Both dialogs still work. Maybe both dialogs have problems if print job options have never been set.
ferdinand
Comment by Ferdinand Hell — May 26, 2008 #
@Ferdinand,
I believe it doesn’t matter what orientation you set the page to, so long as one is set.
As I understand it the application you’re printing from will set it anyway and override the default. The issue appears that Java doesn’t like it when there isn’t a default set.
I’m glad this post is remaining useful.
Comment by techxplorer — May 26, 2008 #
[...] http://techxplorer.com/2008/02/21/printing-issues-with-java-on-linux/ [...]
Pingback by Printing from Java applications in Linux (cups) « Unleash the Tech Freak Inside — July 1, 2008 #
Thanks for fixing the bug.
Comment by Priya — October 16, 2008 #
Thank you very much!!
Comment by canistel — November 1, 2008 #
I have a similar problem but I use Sabayon Linux (gentoo based). Any help on how to do the same in there would be a great help to me.
I use CUPS (with ipp).
I went to localhost:631 and did not see anything for Orientation in there.
My printer is Konica Minolta C250.
Any help on this would be highly appreciated.
Comment by gocool — December 16, 2008 #