How to solve Exception in thread "AWT-EventQueue-0": java.lang.NumberFormatException when opening structs
Show older comments
Hello, I am using MATLAB 2021a on a Windows 10 PC. I have abruptly started to have problems with visualizing structs. When I attempt to open a struct in the workspace by double-clicking on the variable, I receive the "Exception in thread "AWT-EventQueue-0": java.lang.NumberFormatException" error copy-pasted below. As long as the struct is "open" (none of its contents are displayed however), this error will re-print with every command. When the struct is closed, the error does not print. I do not get the same error when I try this with other variable types like doubles and tables. So far, attempting to uninstall and reinstall MATLAB 2021a did not solve the issue. I also installed MATLAB 2019, and I do not have the same problem there, but I need to use MATLAB 2021 or higher for certain functions. Has anyone come across this issue? You can attempt to reproduce it by typing x = struct and double-clicking on x to open
Exception in thread "AWT-EventQueue-0": java.lang.NumberFormatException: For input string: "0ReplaceMatchCase=Bfalse"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)
at com.mathworks.widgets.recordlist.RecordlistTable.decodeColumnMap(RecordlistTable.java:611)
at com.mathworks.widgets.recordlist.RecordlistTable.loadPrefs(RecordlistTable.java:501)
at com.mathworks.widgets.recordlist.RecordlistTable.<init>(RecordlistTable.java:341)
at com.mathworks.widgets.recordlist.RecordlistTable.<init>(RecordlistTable.java:258)
at com.mathworks.mlwidgets.array.editors.WorkspaceLikeTable.<init>(WorkspaceLikeTable.java:100)
at com.mathworks.mlwidgets.array.editors.StructureEditorProvider.createProvider(StructureEditorProvider.java:85)
at com.mathworks.mlwidgets.array.ValueEditorProviderRegistry.getStructureViewer(ValueEditorProviderRegistry.java:358)
at com.mathworks.mlwidgets.array.ValueEditorProviderRegistry.getValueEditorProvider(ValueEditorProviderRegistry.java:63)
at com.mathworks.mlwidgets.array.ValuePanel$UpdateListener.actionPerformed(ValuePanel.java:221)
at com.mathworks.mlwidgets.array.ValueMetaInfoRequester$VICO.matlabEvent(ValueMetaInfoRequester.java:143)
at com.mathworks.jmi.MatlabMCR$AWTReplyEvent.run(MatlabMCR.java:1641)
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)
Accepted Answer
More Answers (1)
Pravarthana P
on 29 Nov 2022
Hi Maryse Thomas,
I tried replicating the issue and I am unable to reproduce it at my end.
To resolve the exception the following workarounds may help:
1. Regenerating the preferences as suggested.
2. 1) Disable the Java Access Bridge software. To do this, use the following steps:
a) Without MATLAB running, open the Windows command terminal, and navigate to the MATLAB installation root.
b) Execute the following command in the Windows terminal:
sys\java\jre\win64\jre\bin\jabswitch.exe /disable
c) Open MATLAB and resume with the normal workflow. The error should be resolved.
Note that if you are using third party accessibility software which uses the Java Access Bridge software, you can re-enable this once MATLAB is running by executing the following in the Windows terminal:
sys\java\jre\win64\jre\bin\jabswitch.exe /enable
2.2) Install the associated patch. To install the patch, use the following steps:
a) Execute the following at the command line:
%% Save the mwswingPatch3.tar file to your matlabroot/java directory
%cd <matlabroot>/java
%tar xvf mwswingPatch3.tar
b) Restart MATLAB.
c) You should see the following messages at the top of the command line:
MJStartupForDesktop.init
MJStartupForDesktop.init - done
If for some reason there is an error, you can remove the patch by doing the following to remove the java/patch directory which was created by the patch above:
%cd <matlab root>/java
%rm -rf patch
Hope the above workarounds will help you!
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!