Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Error getting MATLAB Javabuilder to work

Subject: Error getting MATLAB Javabuilder to work

From: Firoz Anwar

Date: 26 Apr, 2012 00:14:37

Message: 1 of 3

I am new to MATLAB Javabuilder. I am trying to deploy a MATLAB program that I can use in my java program. I have followed the steps in the instruction video of MATLAB JavaBuilder JA. I can successfully deploy .prj file from MATLAB and create .jar file.
Then when i go to Eclipse and create a new project and class upto which things are fine. The problem starts when I am trying to include javabuilder in the Build Path of eclipse project. I could not select the javabuilder.jar to add in the Build path of Eclipse from the path /Application/MATLAB/MATLAB_R2010b.app/toolbox/javabuilder/jar/ because I am on Mac so the application MATLAB_R2010b is not shown as a folder but rather an app icon.

But I could manage to add by deployed jar file path and MATLAB_Compiler_Runtime/v714/toolbox/javabuilder/jar in the path. So when ia write program in java I dont get any compile time error. But when I am running the program I get the following error message from Java program :
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to find the library libmwmclmcrrt.7.14.dylib, 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.14.

        at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ProxyLibraryDir.get(MCRConfiguration.java:167)
        at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ProxyLibraryDir.<clinit>(MCRConfiguration.java:173)
        at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getProxyLibraryDir(MCRConfiguration.java:178)
        at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$MCRRoot.get(MCRConfiguration.java:77)
        at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$MCRRoot.<clinit>(MCRConfiguration.java:87)
        at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getMCRRoot(MCRConfiguration.java:92)
        at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ModuleDir.<clinit>(MCRConfiguration.java:66)
        at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getModuleDir(MCRConfiguration.java:71)
        at com.mathworks.toolbox.javabuilder.internal.MWMCR.<clinit>(MWMCR.java:1553)
        at com.demo.DemoMCRFactory.newInstance(DemoMCRFactory.java:49)
        at com.demo.DemoMCRFactory.newInstance(DemoMCRFactory.java:60)
        at com.demo.MLTestClass.<init>(MLTestClass.java:63)
        at testmatlabdeploy.Main.main(Main.java:26)


I have checked my matlabroot is fine and JAVA_HOME is set properly at MATLAB console but do i need to set anything else?

Please help me I am stuck in this for a long time and couldnt find anything on the web.

Thanks
 

Subject: Error getting MATLAB Javabuilder to work

From: Ed Yu

Date: 23 Jun, 2012 19:01:06

Message: 2 of 3

Firoz,

When executing java programs getting UnsatisfiedLinkError, that means the native library required (DLL on windows) cannot be found. To fiix that, you have several options:

1) add the DLL containing directory to -Djava.library.path=my/path/to/DLL when launching the jvm to run your program,

2) put the DLL containing directory in the environmental variable PATH (on windows platform),

3) put the DLL containing directory in the environmental variable LD_LIBRARY_PATH,

It is difficult to tell which will work for you because it is very dependent on how you set things up, you'll just have to try them all out.

Good Luck,
Ed.

Subject: Error getting MATLAB Javabuilder to work

From: Yair Altman

Date: 24 Jun, 2012 15:46:06

Message: 3 of 3

"Ed Yu" wrote in message <js53pi$deh$1@newscl01ah.mathworks.com>...
> Firoz,
>
> When executing java programs getting UnsatisfiedLinkError, that means the native library required (DLL on windows) cannot be found. To fiix that, you have several options:
>
> 1) add the DLL containing directory to -Djava.library.path=my/path/to/DLL when launching the jvm to run your program,
>
> 2) put the DLL containing directory in the environmental variable PATH (on windows platform),
>
> 3) put the DLL containing directory in the environmental variable LD_LIBRARY_PATH,
>
> It is difficult to tell which will work for you because it is very dependent on how you set things up, you'll just have to try them all out.
>
> Good Luck,
> Ed.

1. (expansion) the -Djava.library.path=my/path/to/DLL should be placed in a java.opts file that is placed in your Matlab startup folder
4. put the DLL path in a librarypath.txt file in your Matlab startup folder

Yair Altman
http://UndocumentedMatlab.com
Read my Matlab-Java programming book
 

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us