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

92 visualizaciones (últimos 30 días)
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)

Respuesta aceptada

mthoma
mthoma el 28 de Nov. de 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:
C:\Users\%username%\AppData\Roaming\MathWorks\MATLAB\R2021a
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”.

Más respuestas (1)

Pravarthana P
Pravarthana P el 29 de Nov. de 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!
  1 comentario
mthoma
mthoma el 29 de Nov. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by