필터 지우기
필터 지우기

How to solve the error: Exception in thread "AWT-EventQueue-0" java.lang.​IllegalArg​umentExcep​tion: Comparison method violates its general contract!

조회 수: 560 (최근 30일)
Hello,
I started receiving an error in matlab, which prevents me to see the command window but does not prevent the code from executing. I attached all the error message below. I do not know why this is happening but I guess it started after I used "save" commands in the editor. I basically load data into the editor and then preprocess the data so that I can use them later, and I save the new data for future computations. Since when I started saving data, this problem has been initiated. Now, I can't stop matlab to produce this error every time I run any code. Can you please help me with this? I really appreciate that, thank you.
Original error:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeHi(Unknown Source)
at java.util.TimSort.mergeAt(Unknown Source)
at java.util.TimSort.mergeCollapse(Unknown Source)
at java.util.TimSort.sort(Unknown Source)
at java.util.Arrays.sort(Unknown Source)
at java.util.ArrayList.sort(Unknown Source)
at java.util.Collections.sort(Unknown Source)
at com.mathworks.widgets.grouptable.GroupingTableUtils.sortNonRecursively(GroupingTableUtils.java:296)
at com.mathworks.widgets.grouptable.RowListTransactionTarget.finishTransaction(RowListTransactionTarget.java:115)
at com.mathworks.widgets.grouptable.GroupingTableTransaction$1.run(GroupingTableTransaction.java:112)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
>>
Sincerely,
Irem Velibeyoglu
  댓글 수: 4
Jaroslav Kautsky
Jaroslav Kautsky 2019년 1월 7일
Interestingly, I started to get same messages, many, many lines. However, I am using version '9.4.0.813654 (R2018a)' on a Linux-Mint notebook, with the -nodesktop option (command window only). I have no files with '0' in the filename in the current directory (as suggested below here). May be I should stop using java? Thank you ..
Omkar Tulankar
Omkar Tulankar 2021년 11월 23일
I was working on simscape multibody to define the motion of a .stp file imported into simulink.
Similar to above java related error , I am recieving following error:
Exception in thread "AWT-EventQueue-0": com.mathworks.physmod.sm.gui.core.exceptions.PmfException: Invalid camera position. The camera position and center are coincident.
at com.mathworks.physmod.sm.gui.gfx.viewer.OsgSceneViewer.fitView(Native Method)
at com.mathworks.physmod.sm.gui.gfx.viewer.OsgSceneViewer.fitView(OsgSceneViewer.java:498)
at com.mathworks.physmod.sm.gui.app.editor.MechEditorPanel.loadGfxInTiledPane_(MechEditorPanel.java:1667)
at com.mathworks.physmod.sm.gui.app.editor.MechEditorPanel.loadModelInternal_(MechEditorPanel.java:965)
at com.mathworks.physmod.sm.gui.app.editor.MechEditorPanel.loadModel(MechEditorPanel.java:880)
at com.mathworks.physmod.sm.gui.app.editor.MechEditorDTClient.openModel(MechEditorDTClient.java:956)
at com.mathworks.physmod.sm.gui.app.editor.MechEditorDTClient.processDTClientCmdLineArgs(MechEditorDTClient.java:1547)
at com.mathworks.physmod.sm.gui.app.editor.MechEditorDTClient.open(MechEditorDTClient.java:1416)
at com.mathworks.physmod.sm.gui.app.editor.MechEditorDTClient.open(MechEditorDTClient.java:1060)
at com.mathworks.physmod.sm.gui.app.editor.NativeMechEditorDTClient$1.run(NativeMechEditorDTClient.java:47)
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)
Suprisingly my other models are working fine ,I am not able to figure out why the above error is being generated

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2016년 4월 2일
This is related to a Java issue, for which there is information at http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7075600
It looks to me as if your choices are:
  • downgrade java versions
  • downgrade to a version of MS Windows is supported by your R2014a
  • upgrade to a version of MATLAB that is supported on Windows 10
  • try to get Mathworks to patch a 2-year old release.
  댓글 수: 2
Irem Velibeyoglu
Irem Velibeyoglu 2016년 4월 5일
I updated MATLAB to a newer version, and the problem seems to be solved. Thank you very much, I really appreciate it.

댓글을 달려면 로그인하십시오.

추가 답변 (5개)

Jim Meyer
Jim Meyer 2016년 5월 10일
편집: Jim Meyer 2016년 5월 10일
I just started getting this error when switching to a specific folder within Matlab. I tracked it down to having added a file with a similar name to a file that already existed in the folder. The file names were "TFH114H.TST" and "TFH0114H.TST". Windows treats them as separate files, but it seems Java is somehow comparing them, treating the numeric characters in the middle as a combined number, ignoring the leading zero in the one file name, and somehow concluding they are the same file and so throwing the error? Adding an extra zero to the second name to make it "TFH00114H.TST" keeps the error, so I think my theory is correct. Renaming the files so the numeric characters do not resolve to the same number cures the problem.
  댓글 수: 4
James Bell
James Bell 2016년 10월 20일
This fixed the same problem for me, too, using R2014b. It seems this version of Matlab doesn't recognise leading zeros in filenames. Great find Jim!

댓글을 달려면 로그인하십시오.


Vahab Youssofzadeh
Vahab Youssofzadeh 2018년 4월 3일
restoredefaultpath is the solution
  댓글 수: 3
Michael McDermott
Michael McDermott 2020년 5월 1일
Thank you! This totally worked after I ran it once... Then I could take it out and still run the code, with the Java problem gone seemingly for now.

댓글을 달려면 로그인하십시오.


Pablo Morcillo Pallarés
Pablo Morcillo Pallarés 2018년 9월 19일
I was also having the same issue, but i solved it in a different way:
i was extracting the maximum value from a table, and the output of that "max" function was giving me a "single" value that later i would use in the axis of a figure. By changing it to "double" the error does not appears again:
from this:
max_=max(Y);
To this:
max_=double(max(Y));

micholeodon
micholeodon 2021년 1월 9일
My answer is not a universal solution but it might be a case for somebody.
I also started to have this error when I accidentally opened a nii.gz (file with the MRI data) file in the Editor. I closed MATLAB and run again - the problem persisted.
Finally problem was solved when I closed a tab in the editor with that nii.gz file.
  댓글 수: 1
Walter Roberson
Walter Roberson 2021년 1월 9일
Ah, that makes some sense. The editor needs java memory for open files, so if you open a large enough file you can run into java problems. Adjusting the java memory preference can postpone this kind of issue, but there will always be files large enough to trigger the problem.

댓글을 달려면 로그인하십시오.


Xin Zhao
Xin Zhao 2021년 5월 16일
install java solves the problem for me

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by