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.






February 22, 2008 at 2:51 am
Ta, that helped.
February 29, 2008 at 7:31 am
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
March 26, 2008 at 9:22 am
[...] 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 [...]
April 5, 2008 at 12:27 pm
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
April 6, 2008 at 6:35 pm
@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.
May 26, 2008 at 12:17 am
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
May 26, 2008 at 8:52 am
@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.
July 1, 2008 at 11:58 pm
[...] http://techxplorer.com/2008/02/21/printing-issues-with-java-on-linux/ [...]
October 16, 2008 at 6:42 pm
Thanks for fixing the bug.
November 1, 2008 at 2:25 am
Thank you very much!!