Java error at startup: Width (0)

5 次查看(过去 30 天)
At the startup of my just acquired MATLAB a reproducible java error occurs.
I am using a macbook late 2009 running the latest OS 13.5.2 (latest).
8GB, 1TB
Java 8 update 381 (should be the latest)
Trace:
Exception in thread "AWT-EventQueue-0": java.lang.IllegalArgumentException: Width (0) and height (22) cannot be <= 0
at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1016)
at java.awt.image.BufferedImage.<init>(BufferedImage.java:351)
at com.apple.laf.AquaPainter$AquaSingleImagePainter.createImage(AquaPainter.java:193)
at com.apple.laf.AquaPainter$AquaSingleImagePainter.lambda$paintFromSingleCachedImage$0(AquaPainter.java:178)
at sun.awt.image.MultiResolutionCachedImage.getResolutionVariant(MultiResolutionCachedImage.java:66)
at sun.java2d.SunGraphics2D.getResolutionVariant(SunGraphics2D.java:3198)
at sun.java2d.SunGraphics2D.drawHiDPIImage(SunGraphics2D.java:3111)
at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3265)
at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3214)
at com.apple.laf.AquaPainter$AquaSingleImagePainter.paintFromSingleCachedImage(AquaPainter.java:186)
at com.apple.laf.AquaPainter$AquaSingleImagePainter.paint(AquaPainter.java:141)
at com.apple.laf.AquaPainter.paint(AquaPainter.java:90)
at com.apple.laf.AquaIcon$JRSUIIcon.paintIcon(AquaIcon.java:80)
at com.apple.laf.AquaIcon$DynamicallySizingJRSUIIcon.paintIcon(AquaIcon.java:108)
at com.apple.laf.AquaButtonUI.paintIcon(AquaButtonUI.java:395)
at com.apple.laf.AquaButtonUI.paint(AquaButtonUI.java:304)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:161)
at javax.swing.JComponent.paintComponent(JComponent.java:780)
at javax.swing.JComponent.paint(JComponent.java:1056)
at javax.swing.JComponent.paintChildren(JComponent.java:889)
at javax.swing.JComponent.paint(JComponent.java:1065)
at com.mathworks.widgets.PromptingTextField.paint(PromptingTextField.java:108)
at javax.swing.JComponent.paintChildren(JComponent.java:889)
at javax.swing.JComponent.paint(JComponent.java:1065)
at javax.swing.JComponent.paintChildren(JComponent.java:889)
at javax.swing.JComponent.paint(JComponent.java:1065)
at javax.swing.JComponent.paintChildren(JComponent.java:889)
at javax.swing.JComponent.paint(JComponent.java:1065)
at javax.swing.JComponent.paintChildren(JComponent.java:889)
at javax.swing.JComponent.paint(JComponent.java:1065)
at javax.swing.JComponent.paintChildren(JComponent.java:889)
at javax.swing.JComponent.paint(JComponent.java:1065)
at javax.swing.JComponent.paintChildren(JComponent.java:889)
at javax.swing.JComponent.paint(JComponent.java:1065)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:586)
at javax.swing.JComponent.paintChildren(JComponent.java:889)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5217)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1579)
at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1502)
at javax.swing.RepaintManager.paint(RepaintManager.java:1272)
at javax.swing.JComponent.paint(JComponent.java:1042)
at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:39)
at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:79)
at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:116)
at java.awt.Container.paint(Container.java:1978)
at java.awt.Window.paint(Window.java:3906)
at javax.swing.RepaintManager$4.run(RepaintManager.java:842)
at javax.swing.RepaintManager$4.run(RepaintManager.java:814)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:814)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:789)
at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:738)
at javax.swing.RepaintManager.access$1200(RepaintManager.java:64)
at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1732)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

回答(1 个)

Maneet Kaur Bagga
Maneet Kaur Bagga 2023-9-20
Hi Anton,
As per my understanding the error message indicates an "IllegalArgumentException" in the Java code related to the creation of a compatible writable raster for an image. It states that the width(0) and height(22) cannot be less than or equal to zero.
The error suggests that there might be an issue with the dimensions of the image being used by MATLAB, possibly during the rendering of a graphical user interface (GUI) component. It could be related to the specific version of Java or the macOS compatibility.
Plese refer to the troubleshooting steps below :
  • The error may be resolved by resetting MATLAB preferences to their default values. To do this, launch MATLAB and go to the "Home" tab. In the "Environment" section, click on "Preferences". In the preferences window, click on "Factory Defaults" and then "OK". Restart MATLAB and check if the error persists.
  • The error might be due to the Java's AWT/Swing acceleration which can cause graphical errors. It can be disabled as follows:
java.lang.System.setProperty('java.awt.headless', 'true');
  • Verify that the Java installation is correct and the version is compatible with the operating system.
If none of the above steps work, please contact MathWorks Technical Support.
Hope this helps!
Thank You
Maneet Bagga
  1 个评论
Anton van Oosten
Anton van Oosten 2023-12-4
Thank you for your answer, which I saw only today.
I performed the java command but the setting is not retained upon quit and restart.
I was unable to locate a ractory reset in the prefs.
It's just a cosmetic issue, probably, but still.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by