Java_call.m line 39 Error


** Error: Line 39: java_call (line 39)
** Java exception occurred:
** java.lang.IllegalArgumentException: Comparison method violates its general contract!

** at java.util.ComparableTimSort.mergeHi(ComparableTimSort.java:866)

** at java.util.ComparableTimSort.mergeAt(ComparableTimSort.java:483)

** at java.util.ComparableTimSort.mergeForceCollapse(ComparableTimSort.java:422)

** at java.util.ComparableTimSort.sort(ComparableTimSort.java:222)

** at java.util.Arrays.sort(Arrays.java:1246)

** at sun.awt.shell.Win32ShellFolderManager2.get(Win32ShellFolderManager2.java:282)

** at sun.awt.shell.ShellFolder.get(ShellFolder.java:258)

** at com.sun.java.swing.plaf.windows.WindowsFileChooserUI$DirectoryComboBoxModel.addItem(WindowsFileChooserUI.java:1073)

** at com.sun.java.swing.plaf.windows.WindowsFileChooserUI$DirectoryComboBoxModel.access$800(WindowsFileChooserUI.java:1041)

** at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.doDirectoryChanged(WindowsFileChooserUI.java:730)

** at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.access$1100(WindowsFileChooserUI.java:55)

** at com.sun.java.swing.plaf.windows.WindowsFileChooserUI$11.propertyChange(WindowsFileChooserUI.java:821)

** at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)

** at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)

** at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)

** at java.awt.Component.firePropertyChange(Component.java:8434)

** at javax.swing.JFileChooser.setCurrentDirectory(JFileChooser.java:598)

** at org.brainstorm.file.BstFileSelector.showSameThread(BstFileSelector.java:86)

** at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

** at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

** at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

** at java.lang.reflect.Method.invoke(Method.java:498)

** at com.mathworks.jmi.AWTUtilities$Invoker$3$1.call(AWTUtilities.java:525)

** at com.mathworks.mvm.context.ThreadContext.callWithContext(ThreadContext.java:105)

** at com.mathworks.mvm.context.MvmContext.callWithContext(MvmContext.java:113)

** at com.mathworks.jmi.AWTUtilities$Invoker$3.runWithOutput(AWTUtilities.java:522)

** at com.mathworks.jmi.AWTUtilities$Invoker$2.watchedRun(AWTUtilities.java:475)

** at com.mathworks.jmi.AWTUtilities$WatchedRunnable.run(AWTUtilities.java:436)

** 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)

**
** Call stack:
** >java_call.m at 39
** >java_getfile.m at 145
** >import_data.m at 99
** >bst_call.m at 28
** >tree_callbacks.m>@(h,ev)bst_call(@import_data,[],[],[],iStudy,iSubject) at 662
**


Same comment as your other post: we need some more context to help you here.

As this is related with a version of Matlab that was tested before the release of Windows11, it could be due to some incompatibilities between Windows 11 and the version of Java used in your installation of Matlab.

One thing you could try is to use a different JVM (JRE):
https://www.mathworks.com/matlabcentral/answers/130359-how-do-i-change-the-java-virtual-machine-jvm-that-matlab-is-using-on-windows

Hi Francois,

Which version will you suggest installing? I tried a few but no luck so far. It worked yesterday till at one point, it stopped, which led to the reinstallation... So I am not sure why it was the case.

Thanks.

Should I remove 32 bits and other JAVA that were already installed?
Also, I should just choose one to download, right?

Also, I got new errors now.

Error using java_call
Java exception occurred:
java.lang.IllegalArgumentException: Comparison
method violates its general contract!

Should I remove 32 bits and other JAVA that were already installed?

No, you don't need to, you can have many versions of Java installed on your computer.
You just need to configure Matlab to use the correct one.
Type "ver" in Matlab after starting it to make sure it is using the correct JVM.

Also, I should just choose one to download, right?

Or you can try them all if each one gives different errors.

Also, I got new errors now.

For any error you report, you really need to explain exactly how this arises, otherwise we can't do anything with it.

The best if possible would be to install Matlab 2022a instead.
Alternatively, you could try: running the compiled version of Brainstorm with the Runtime 2022a.

Thanks for the help.

I was able to fix the problem after doing some extra research.

The problem apparently originated from not having the same JAVA version between the PATH (in MATLAB) and the environmental properties (within the program file). After uniforming the two parameters, I am now able to use the toolbox again.