1

I used the Matlab deployment tool to build a matlab code into a java project. I am having some problem with the Matlab-Java interface, the error while running the java code is:

Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to find the library mclmcrrt7_15.dll, required by MATLAB Builder JA, on java.library.path. This library is typically installed along with MATLAB or the MCR, its absence may indicate an issue with that installation or the current path configuration.The MCR version that this component is trying to use is: 7.15.

When I type "version -java" in the Matlab console, the answer is Java 1.6.0_17-b04. So,I changed my Path in the system settings to ...\Files\Java\jdk1.6.0_33\bin But since I have Java version-7 installed, It is not using version-6. In command prompt, when I checked the version of java and javac, I saw that the version of javac is 1.6 but that of java is 1.7. I also made a CLASSPATH environment variable and a JAVAHOME variable and set it to 1.6. Could you please tell me how do I change the java version being used by the system to 1.6 so that matlab can interact with it?

I think this is the problem, but I am just guessing from the error message. Please let me know if the problem is something else, and not just the incompatibility in java versions.

Don Roby
  • 40,677
  • 6
  • 91
  • 113
  • Referring to [Thread Subject: MCR on Windows 7 64bit - help!](http://www.mathworks.fr/matlabcentral/newsreader/view_thread/313854)I might guess you need to install the MCR that complies with the deployment tool. – zellus Jul 01 '12 at 13:48
  • @user1493972: read first part of this: http://stackoverflow.com/a/11056140/97160 – Amro Jul 01 '12 at 14:21

2 Answers2

0

Is the DLL mclmcrrt7_15.dll on the PATH anywhere?

For Java to be able to load a DLL, the DLL needs to be in a folder listed in the java.library.path system property. The default value for this property on Windows is the PATH environment variable.

Luke Woodward
  • 63,336
  • 16
  • 89
  • 104
  • The DLL mclmcrrt7_15.dll was originally in the folder C:\Program Files\MATLAB\MATLAB Compiler Runtime\v715\runtime\win64 – user1493972 Jul 01 '12 at 14:11
  • but I copied it to the PATH folder. It is still giving the same error. – user1493972 Jul 01 '12 at 14:11
  • Why have you copied the DLL to a folder already on the `PATH` instead of adding the folder containing the DLL to the `PATH`??? Maybe this DLL is trying to look for other DLLs in this folder and is failing to load because it can't find them? – Luke Woodward Jul 01 '12 at 14:18
  • 1
    Okay, my bad. Now I added the folder containing the DLL to the PATH. It still is giving the same error.. – user1493972 Jul 01 '12 at 15:23
  • Have you restarted MATLAB since you changed the PATH? (I admit I've not actually used MATLAB and Java together, and I don't have access to a MATLAB installation at the moment but I have worked with Java and external DLLs before. I also admit I'm running out of ideas about how to fix your problem.) – Luke Woodward Jul 01 '12 at 20:28
0

Just fix the same error on my machine. In my case, it is fixed by add the MATLAB path into the SYSTEM environment variables:

add in PATH

-C:\Program Files\MATLAB\R2011a\bin;
-C:\Program Files\MATLAB\R2011a\runtime\win64

Wish it is helpful.

Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291