Why do I get Java exceptions java.lang.​NullPointe​rException when I use MATLAB with Window Magnet or similar apps on Mac?

86 views (last 30 days)
I have noticed when I am running MATLAB on my Mac system where I have installed an app that manipulates window displays (such as "Window Magnet" or "Cinch"), I get a series of Java exception errors. These typically happen when the MATLAB desktop opens a new window (for instance, when opening a file). How can I resolve these errors?
Here is an example:
java.lang.NullPointerException
java.lang.NullPointerException
at javax.swing.JList$AccessibleJList$AccessibleJListChild.getAccessibleValue(JList.java:3400)
at sun.lwawt.macosx.CAccessibility$31.call(CAccessibility.java:542)
at sun.lwawt.macosx.CAccessibility$31.call(CAccessibility.java:534)
at sun.lwawt.macosx.LWCToolkit$CallableWrapper.run(LWCToolkit.java:511)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:302)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:708)
at java.awt.EventQueue$4.run(EventQueue.java:706)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
java.lang.NullPointerException
at javax.swing.JList$AccessibleJList$AccessibleJListChild.getAccessibleValue(JList.java:3400)
at sun.lwawt.macosx.CAccessibility$31.call(CAccessibility.java:542)
at sun.lwawt.macosx.CAccessibility$31.call(CAccessibility.java:534)
at sun.lwawt.macosx.LWCToolkit$CallableWrapper.run(LWCToolkit.java:511)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:302)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:708)
at java.awt.EventQueue$4.run(EventQueue.java:706)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 19 Mar 2020
Window Magnet, Cinch, PopClip, Moom and similar apps are third party software, so we cannot guarantee compatibility between them and MATLAB.
The above error is related to "Accessibility", which is also known as "Universal Access" for Mac (this is under Apple menu > System preferences > Universal Access). This is an issue with third-party applications on Mac that interfere with Java's accessibility code, and it is not specific to one single action, but it can occur with any feature of MATLAB using Java. It has been observed to take place in startup, when using the Live Editor, and also when making use of the Add-Ons button and Add-Ons, Packages and Apps managers. There are several Java bugs related to Accesibility and reported by Oracle.
Typically this exception can be safely ignored. If you want to get rid of this exception:
To workaround this issue, check if the interaction between the third party software and MATLAB can be disabled. For instance, Magnet application has an option to "Ignore MATLAB" shown as below:
If above method doesn't work, completely disable Accessibility ("Universal Access") in your Mac. Please reboot your computer and restart MATLAB afterwards.
In case this does not solve the issue, you may need to delete the file "com.apple.universalaccess.plist". You can restart your Mac afterwards, so that it is now started with the default "com.apple.universalaccess.plist" file. Please refer to the following link for more information about deleting this kind of files:
If it is not possible for you to completely disable Universal Access, you may try to work around this issue by only disabling the apps that are making use of it. It has been previously observed that such errors are getting generated with third party applications like "bettertouchtool", "bettersnaptool" or "cinch" installed on the system.
Below is a list of some third-party Accessibility software that has been seen to result in Java errors in MATLAB:
  1. Bettertouchtool
  2. Bettersnaptool
  3. Cinch
  4. Moom
  5. PopClip
  6. Window Magnet or Magnet
  7. BeardedSpice
If the system has some of the above mentioned, or any other third party extensions that require "Universal Access" to be enabled, then uninstall them, restart the system and then open MATLAB to see if the issue has been resolved. You can check which apps are making use of Universal Access on the Apple menu > System preferences > Universal Access.
If there are any third party applications that are useful to you and it is not possible for you to uninstall them, try the following steps: # (After uninstalling all of them as mentioned above) Re-install each application that needs "Universal Access" to be enabled one at a time. Reboot the system and restart MATLAB to see which is the application that is causing the incompatibility. # If no errors are generated, the application can be used. Otherwise, it needs to be uninstalled as MATLAB does not support all third party applications currently.

More Answers (0)

Categories

Find more on Search Path in Help Center and File Exchange

Products


Release

No release entered yet.

Community Treasure Hunt

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

Start Hunting!