Skip to main content
DMcQ
Known Participant
January 30, 2014
Question

Launching Matlab executable from AIR: can't find dll?

  • January 30, 2014
  • 1 reply
  • 1909 views

I'm trying to use NativeProcess to run an executable generated by Matlab (blah). I've called it "engine.exe"

I've installed the Matlab Compiler Runtime (MCR) and I can call the engine.exe fine from the directory I want to run it in when using the command line.

But when I try to call the same executable with the same arguments via NativeProcess, I get a MCR Error dialog "Could not find version 8.2 of the MCR. Attempting to load mclmcrrt8_2.dll..."

Interestingly, I can see this mclmcrrt8_2.dll in C:\Program Files\MATLAB\MATLAB Compiler Runtime\v82\runtime\win64

And that path is part of my PATH setting on my pc. So not sure why I can run engine.exe fine with the command line but it gives this error when trying to run from NativeProcess.

So the only thing I can think of is that when the exe is run via NativeProcess, it somehow can't see the PATH settings? Could that be true?

Thanks for any thoughts.


Daniel

This topic has been closed for replies.

1 reply

DMcQ
DMcQAuthor
Known Participant
January 30, 2014

What's interesting is that if I create a .bat file with the following contents:

     set PATH=%PATH%;C:\Program Files\MATLAB\MATLAB Compiler Runtime\v82\runtime\win64

     Engine.exe %1

And then set up NativeProcess to call the .bat file via cmd.exe:

     nativeProcessStartupInfo.executable = shellExe;                        //File object pointing to C:\WINDOWS\system32\cmd.exe

     nativeProcessStartupInfo.workingDirectory = workingDir;          //File pointing to my working directory in a subdirectory in my Users folder. Holds the Engine exe & bat.

     ...

     processArgs.push("\c")

     processArgs.push(engineBat.nativePath);                                   //Path to my engine.bat file.

     processArgs.push(workingDir.nativePath);                                   //The Engine.exe needs this to find an input file it wants

     ...    

The exe runs!

Which leads me to believe somehow when running an .exe via NativeProcess it can't see the PATH settings, which seems crazy. So I must be missing something.

Thanks for any thoughts.


Daniel