Why do I get java error when I open Matlab on MacOS?

47 次查看(过去 30 天)
The error message is as follows:
java.lang.NullPointerException
at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:57)
at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:36)
at java.lang.reflect.Field.get(Field.java:393)
at sun.lwawt.macosx.CAccessibility.getAccessibleRoleFor(CAccessibility.java:248)
at sun.lwawt.macosx.CAccessibility$12.call(CAccessibility.java:263)
at sun.lwawt.macosx.CAccessibility$12.call(CAccessibility.java:260)
at sun.lwawt.macosx.LWCToolkit$CallableWrapper.run(LWCToolkit.java:597)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
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.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
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)

采纳的回答

Swaraj
Swaraj 2024-1-12
Hi,
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 the 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 Accessibility and reported by Oracle. The workaround for this issue is to completely disable Accessibility ("Universal Access") on your Mac. Please reboot your computer and restart MATLAB afterward. In case this does not solve the issue, you may need to delete the file "com.apple.universalaccess.plist". You can restart your Mac afterward 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 file:
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:
BettertouchtoolBettersnaptoolCinchMoomPopClipWindow Magnet or MagnetBeardedSpice
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 step:(After uninstalling all of them as mentioned above) Re-install each application that needs "Universal Access" to enable 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.
Hope it helps!

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 启动和关闭 的更多信息

标签

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!