MATLAB Runtime 2022b installation missing v913 in pathname

Hi Francois,

I installed Matlab Runtime 2022b on a Windows 10 machine, download the binary for that version, and tried to run the batch file command:

Matlab R2022b found:
C:\Program Files\MATLAB\MATLAB Runtime\R2022b\v913

ERROR: java.exe was not found in "C:\Program Files\MATLAB\MATLAB Runtime\R2022b\v913\sys\java\jre<arch>\jre\bin"

I re-installed MCR 2022b on another Windows 10 machine to confirm that v913 is not in the pathname. Instead, I find the jave.exe file in

C:\Program Files\MATLAB\MATLAB Runtime\R2022b\sys\java\jre\win64\jre\bin

I don't know why we're not seeing v913 in the pathname from the installation. Is this a new flavor from the Mathworks, or are we missing something?

We are installing MCR 2020a now to try the older version of Brainstorm binary.

Hello Francois,
I believe that I am having a similar issue to what the above user has described. If you prefer that I start a different thread, please let me know. Here are the details:

I am trying to run the brainstorm binary version using MATLAB Runtime 2022b on a Windows 10 machine.
When I try to execute it using the brainstorm3.bat file, I get the following output in the command line:


MATLAB 2022b found
ECHO is on
ERROR: java.exe was not found in \sys\java\jre\<arch>\jre\bin

The path to the '.java exe' file on my computer is: 'C:\Program Files\MATLAB\MATLAB Runtime\R2022b\sys\java\jre\win64\jre\java.exe'

I am trying to follow troubleshooting instructions at two of your links, which I have pasted below. I understand that the solution is to edit the path for @SET MATLABROOT, in the brainstorm3.bat file.
However, I don't know which @SET MATLABROOT line to edit + what path to paste in it. Would you be able to clarify this?

Links:

https://neuroimage.usc.edu/brainstorm/Installation

Thank you for your time.

Best,
Diksha

Okay, I confirmed two things and solved my problem for now:

From the Mathworks, I installed their MCR 2020a for win64, and I had no problems running Brainstorm 2020a (bst_bin_R2020a_230223).

But I see that Mathworks installed that version into v98, while Mathworks install MCR 2022b into R2022b, instead of v98.

C:\Program Files\MATLAB\MATLAB Runtime\R2022b
vs
C:\Program Files\MATLAB\MATLAB Runtime\v98

So I went into your brainstorm3.bat file in (bst_bin_R2022b_230130)
..\bst_bin_R2022b_230130\brainstorm3\bin\R2022b

and altered the single line in the header of your script from
@ECHO.
@SET MATLABROOT=
@SET VER_NAME=R2022b
@SET VER_NUMBER=9.13
@SET MCR_FOLDER=v913

to

@SET MCR_FOLDER=R2022b

and your brainstorm3.bat file worked perfectly.

I can only guess that Mathworks has done another default change in the way that MCR files are installed. If you can confirm the same, you may need to change the distributed brainstorm3.bat file?

  • John

It looks like the default installation path of the Matlab Runtime changed, indeed. I think this is better this way, as "9.13" makes no sense to someone who installed the "Runtime 2022b".

The first part of of the brainstorm3.bat tries to get the MATLABROOT folder from standard installation paths. I added here two more tests for trying to find the Matlab Runtime installation paths (VER_NAME=R2022b):

@IF EXIST "C:\Program Files\MATLAB\MATLAB Runtime\%VER_NAME%\sys\java\jre" (
    @SET "MATLABROOT=C:\Program Files\MATLAB\MATLAB Runtime\%VER_NAME%"
    @GOTO :TEST_JAVA
)
@IF EXIST "C:\Program Files (x86)\MATLAB\MATLAB Runtime\%VER_NAME%\sys\java\jre" (
    @SET "MATLABROOT=C:\Program Files (x86)\MATLAB\MATLAB Runtime\%VER_NAME%"
    @GOTO :TEST_JAVA
)

What concerns me more is the failure of the second part of the script, which gets the installation path from the Matlab registry.

@dsrishyla @John_Mosher
Could you please open a Windows CMD terminal, execute the following commands and copy-paste the full output here?

REG QUERY "HKLM\SOFTWARE\MathWorks\MATLAB Runtime" /s
REG QUERY "HKLM\SOFTWARE\MathWorks\MATLAB" /s

Note that setting the MATLABROOT folder in brainstorm3.bat is documented in the installation page:
https://neuroimage.usc.edu/brainstorm/Installation#Start_Brainstorm

Here you go:

Microsoft Windows [Version 10.0.19042.1706]
(c) Microsoft Corporation. All rights reserved.

O:\>REG QUERY "HKLM\SOFTWARE\MathWorks\MATLAB Runtime" /s

HKEY_LOCAL_MACHINE\SOFTWARE\MathWorks\MATLAB Runtime\9.13
    MATLABROOT    REG_SZ    C:\Program Files\MATLAB\MATLAB Runtime\R2022b

HKEY_LOCAL_MACHINE\SOFTWARE\MathWorks\MATLAB Runtime\9.8
    MATLABROOT    REG_SZ    C:\Program Files\MATLAB\MATLAB Runtime


O:\>REG QUERY "HKLM\SOFTWARE\MathWorks\MATLAB" /s

HKEY_LOCAL_MACHINE\SOFTWARE\MathWorks\MATLAB\9.10
    MATLABROOT    REG_SZ    C:\Program Files\MATLAB\R2021a

HKEY_LOCAL_MACHINE\SOFTWARE\MathWorks\MATLAB\9.12
    MATLABROOT    REG_SZ    C:\Program Files\MATLAB\R2022a

HKEY_LOCAL_MACHINE\SOFTWARE\MathWorks\MATLAB\9.6
    MATLABROOT    REG_SZ    C:\Program Files\MATLAB\R2019a

And here's the startup of 2022b on my machine. I don't see any errors posted, nor have I encounted any, but I have not extensively tested this binary version.

Matlab R2022b found:
C:\Program Files\MATLAB\MATLAB Runtime\R2022b

Please wait...

If it hangs for more than a few minutes: try pressing ENTER.
Alternatively, download Brainstorm for a different version of the Matlab Runtime.
(See the installation instructions on the Brainstorm website)


BST> Starting Brainstorm:
BST> =================================
BST> BrainstormHomeDir = C:\Users\jmosher\AppData\Local\Temp\jmosher\mcrCache9.13\bst_ja0\bst_javabuil
BST> Version: 28-Jan-2023
BST> Compiling main interface files...
BST> Deleting old process reports...
BST> Loading configuration file...
BST> Initializing user interface...
BST> Starting OpenGL engine... hardware
BST> Plugin [...]
BST> Reading process folder...
BST> Loading current protocol...
BST> =================================

This illustrates the change: previously, the registry entry indicated only the path up to "MATLAB Runtime", so my batch script was adding the missing version folder (e.g. "v98").
Now, the installer registers the path including the version name (R2022b). This cause the script to generate the erroneous path you reported in your first post: C:\Program Files\MATLAB\MATLAB Runtime\R2022b\v913
Changes in Matlab are always annoying because it makes me work extra. But this one is actually fixing a "bug" of the previous installers.

I think this commit will fix the problem: Bugfix: Compiled brainstorm3.bat with new 2022b REG entry · brainstorm-tools/brainstorm3@5b27a50 · GitHub

Please update the Brainstorm bin package and try again running the brainstorm3.bat without any modification.

This error is different : the path was not found in the registry, but it didn't report it wasn't found. I don't understand this...
Can you please try the following: save the script below as a file "getpath.bat", then double-click on it to execute it, and finally copy-paste here the full output. If the window closes too fast: open a CMD terminal, CD to the folder where the .bat file is saved, and execute it from the command line.
test.zip (394 Bytes)

@REG QUERY "HKLM\SOFTWARE\MathWorks\MATLAB Runtime" /s

@SET MATLABROOT=
@SET VER_NUMBER=9.13

@SET MKEY="HKLM\SOFTWARE\MathWorks\MATLAB Runtime\%VER_NUMBER%"
@ECHO GET %MKEY%
@ECHO.
@FOR /F "skip=2 tokens=2*" %%A IN ('REG QUERY %MKEY% /v MATLABROOT 2^>NUL') DO @SET MATLABROOT=%%B

@IF DEFINED MATLABROOT (
    @ECHO Matlab found:
    @ECHO MATLABROOT=%MATLABROOT%
    @GOTO :END
)

@ECHO Matlab not found.

:END

@Francois, I re-downloaded/reinstalled the Brainstorm bin package as you suggested above, and now it is working. Thanks to you and @John_Mosher for working through this.
Anyhow, here is the output you requested from executing test.bat:

> HKEY_LOCAL_MACHINE\SOFTWARE\MathWorks\MATLAB Runtime\9.13
>     MATLABROOT    REG_SZ    C:\Program Files\MATLAB\MATLAB Runtime\R2022b
> 
> GET "HKLM\SOFTWARE\MathWorks\MATLAB Runtime\9.13"
> 
> Matlab found:
> MATLABROOT=C:\Program Files\MATLAB\MATLAB Runtime\R2022b

Hi Francois,

I downloaded your .bat file from github and used it in place of the original. Worked fine!

I ran with a fellow for awhile and encountered one error, apparently unrelated to this, so I'll make a new topic. But otherwise, your new .bat file fixed the issue, thanks!

  • John