Why am i getting this error code when i try to print? I can't tell if this is a matlab error or an error in my pc's coding.

3 views (last 30 days)
Alexander Hallett
Alexander Hallett on 11 Dec 2015
Answered: Shruti Sapre on 16 Dec 2015
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 87
at sun.print.Win32PrintService.getMediaSizes(Unknown Source)
at sun.print.Win32PrintService.initMedia(Unknown Source)
at sun.print.Win32PrintService.isSupportedMedia(Unknown Source)
at sun.print.Win32PrintService.getDefaultAttributeValue(Unknown Source)
at com.mathworks.widgets.text.print.PrintSettings.getLastPrintRequestAttributes(PrintSettings.java:310)
at com.mathworks.mde.cmdwin.XCmdWndView.print(XCmdWndView.java:1350)
at com.mathworks.mde.cmdwin.CmdWinEditorKit$PrintAction.actionPerformed(CmdWinEditorKit.java:1495)
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:1185)
at com.mathworks.mwswing.plaf.MBasicMenuItemUI$MouseInputHandler.mouseReleased(MBasicMenuItemUI.java:1005)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
  3 Comments

Sign in to comment.

Answers (1)

Shruti Sapre
Shruti Sapre on 16 Dec 2015
Hi Alexander,
The problem likely originates from having a registered printer with an incompatible driver. The incompatibility could be between the printer driver and Java. If a printer driver for an additional registered printer is incorrect, you may not be able to print even if the default printer driver is correct. To work around this issue, you could try the following:
1. Make sure that all registered printers have up-to-date drivers. If this does not solve the problem, it should be possible to unregister the printers individually and determine which one is causing the failure. If you leave that printer unregistered, it should then be possible to print to a different printer.
2. Try deleting and then reinstalling all printers. This process may update all the drivers and solve the issue.
3. If all else fails, an alternate workaround would be to copy and paste into another text editor to print.
Hope this helps!
-Shruti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by