MATLAB: Do I receive Java error messages while trying to print a figure from the figure window, or a MATLAB file from the editor window in MATLAB 7.6 (R2008a) on Redhat Linux

cupserrorexceptionjavalinuxm-filemacMATLABprintunix

While trying to print a figure from the figure window, or a MATLAB file from the editor window, I receive the following Java error messages even though I am able to print successfully from the Command line using PRINT.
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: null attribute
at sun.print.IPPPrintService.isAttributeValueSupported(Unknown Source)
at sun.print.ServiceDialog$OrientationPanel.updateInfo(Unknown Source)
at sun.print.ServiceDialog$PageSetupPanel.updateInfo(Unknown Source)
at sun.print.ServiceDialog.updatePanels(Unknown Source)
at sun.print.ServiceDialog.initPrintDialog(Unknown Source)
at sun.print.ServiceDialog.<init>(Unknown Source)
at javax.print.ServiceUI.printDialog(Unknown Source)
at com.mathworks.widgets.text.print.PrintSettings.showPrintDialog(PrintSettings.java:665)
at com.mathworks.widgets.SyntaxTextPaneBase.printDocument(SyntaxTextPaneBase.java:2302)
at com.mathworks.widgets.SyntaxTextPaneMultiView.printDocument(SyntaxTextPaneMultiView.java:740)
at com.mathworks.mde.editor.EditorView.doPrint(EditorView.java:1342)
at com.mathworks.mde.editor.EditorView.access$2700(EditorView.java:53)
at com.mathworks.mde.editor.EditorView$7.update(EditorView.java:604)
at com.mathworks.mde.editor.EditorAction$ObservableAction.actionPerformed(EditorAction.java:52)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at com.mathworks.mwswing.plaf.MBasicMenuItemUI.doClick(MBasicMenuItemUI.java:1141)
at com.mathworks.mwswing.plaf.MBasicMenuItemUI

Best Answer

This error message occurs when the version of Common Unix Printing System (CUPS) used is 1.3.4 or higher. Since the version of MATLAB on your system is independent from the version of CUPS, this issue is not limited to R2008a.
To determine the version of CUPS on your system, use the directions on the following website:
<http://www.cups.org/articles.php?L276+TFAQ+Q>
Before proceeding with this solution, make sure that your version of CUPS is 1.3.4 or newer.
This issue is caused due to a bug in Sun’s Java Virtual Machine.
Information regarding this issue can be found at the following links:
<http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6633656>
<http://permalink.gmane.org/gmane.comp.printing.cups.bugs/4780>
These are the possible workarounds:
1. Some Ubuntu 8.03 -64 users have found the problem was resolved by navigating to System->Administration->Printing and then the "Job Options" tab, and changing the "Orientation" list to something other than Automatic, for example "Portrait".
2. Revert back to an older version of CUPS. For information about how to do this, check the Web site at:
<http://www.cups.org/>
If you need more information about how to revert to a previous version, you may need to consult one of the CUPS support pages or forums.
3. Add the following to each printer's /etc/cups/printers.conf:
Option orientation-requested 3
Then restart CUPS using the following command:
/etc/init.d/cups restart
For more information, see the following URL:
<http://www.pikopong.com/blog/2008/09/09/java-printing-fix-for-linux-with-cups/>