Filter löschen
Filter löschen

How to solve Exception in thread "AWT-EventQueue-0": java.lang.​NumberForm​atExceptio​n when opening structs

75 Ansichten (letzte 30 Tage)
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(
at java.lang.Integer.parseInt(
at java.lang.Integer.parseInt(
at com.mathworks.widgets.recordlist.RecordlistTable.decodeColumnMap(
at com.mathworks.widgets.recordlist.RecordlistTable.loadPrefs(
at com.mathworks.widgets.recordlist.RecordlistTable.<init>(
at com.mathworks.widgets.recordlist.RecordlistTable.<init>(
at com.mathworks.mlwidgets.array.editors.WorkspaceLikeTable.<init>(
at com.mathworks.mlwidgets.array.editors.StructureEditorProvider.createProvider(
at com.mathworks.mlwidgets.array.ValueEditorProviderRegistry.getStructureViewer(
at com.mathworks.mlwidgets.array.ValueEditorProviderRegistry.getValueEditorProvider(
at com.mathworks.mlwidgets.array.ValuePanel$UpdateListener.actionPerformed(
at com.mathworks.mlwidgets.array.ValueMetaInfoRequester$VICO.matlabEvent(
at com.mathworks.jmi.MatlabMCR$
at java.awt.event.InvocationEvent.dispatch(
at java.awt.EventQueue.dispatchEventImpl(
at java.awt.EventQueue.access$500(
at java.awt.EventQueue$
at java.awt.EventQueue$
at Method)
at java.awt.EventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForFilters(
at java.awt.EventDispatchThread.pumpEventsForFilter(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(

Akzeptierte Antwort

mthoma am 28 Nov. 2022
In case anyone comes across this thread, I was able to solve my issue by regenerating my preferences. Here are the steps that were sent to me by MathWorks support. Hope it can help someone in the future!
Another troubleshooting step you can try is regenerating your preferences. To do this first locate the MATLAB Preference directory. This can be found by going to the following location:
Or by running the following command in the MATLAB Command Window:
>> prefdir
In this directory there should be a “matlab.prf” file. Make sure MATLAB is closed and rename the directory from R2021a to R2021a_old. Then create a new empty folder with the name “R2021a”.
Then restart MATLAB and it will create the preferences file in the new folder. If this does not work you can always revert back to your old preferences by deleting the new folder and renaming “R2021a_old” back to “R2021a”.

Weitere Antworten (1)

Pravarthana P
Pravarthana P am 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 - 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!
  1 Kommentar
mthoma am 29 Nov. 2022
Thank you very much for this response! Your solution #1 worked for me in this case, but I am glad to know that there are additional troubleshooting steps I can take if this ever happens again. It is much appreciated.

Melden Sie sich an, um zu kommentieren.


Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by