Thread Subject: Matlab Builder JA and eclipse

Subject: Matlab Builder JA and eclipse

From: Johnathan

Date: 2 Jul, 2009 01:55:02

Message: 1 of 4

Hey guys, I'm trying to use the matlab builder JA with eclipse, but I keep getting the following error when the example program getmagic.java runs, which occurs when the program tries to execute the statement:

theMagic = new magic();

I have added magicsquare.jar and javabuilder.jar as external jars to the build path.
I was going off of the notes I found here:

http://www.mathworks.com/matlabcentral/fx_files/22811/1/MATLAB_builder_for_JAVA.pdf

except that I'm running on mac OSX.

Does anyone know what is going on? I am very new to Java.

Thanks
--John
__________________________________________________________________
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to find the library libmwmclmcrrt.7.10.dylib, required by MATLAB Builder JA, on java.library.path

at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ProxyLibraryDir.get(MCRConfiguration.java:123)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ProxyLibraryDir.<clinit>(MCRConfiguration.java:126)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getProxyLibraryDir(MCRConfiguration.java:131)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$MCRRoot.get(MCRConfiguration.java:62)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$MCRRoot.<clinit>(MCRConfiguration.java:72)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getMCRRoot(MCRConfiguration.java:77)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ModuleDir.<clinit>(MCRConfiguration.java:51)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getModuleDir(MCRConfiguration.java:56)
at com.mathworks.toolbox.javabuilder.internal.MWMCR.<clinit>(MWMCR.java:1447)
at com.mathworks.toolbox.javabuilder.MWUtil.GetUnknownClassID(MWUtil.java:1258)
at com.mathworks.toolbox.javabuilder.MWClassID.<clinit>(MWClassID.java:41)
at getmagic.main(getmagic.java:37)

Subject: Matlab Builder JA and eclipse

From: Johnathan

Date: 2 Jul, 2009 06:13:01

Message: 2 of 4

Just thought I would be a little more clear. I tried my own little code.

I have an M-file:
__________________________________________________________
function JavaBuilderTest
disp('the function worked and you are a big strong man')
end
__________________________________________________________
which is placed in a .jar file javaBuilderTest.jar by the deployment tool.
I have added the javaBuilderTest.jar and javabuilder.jar files to the build path as libraries.

I have written this short class called DisplayTest.java:

__________________________________________________________
import com.mathworks.toolbox.javabuilder.*;
import javaBuilderTest.*;

public class DisplayTest
{
public static void main(String[] args) throws MWException
{
                System.out.println("Preparing to not work in 3...2...1...");
JavaBuilderTest MyObject = new JavaBuilderTest();
}
}
__________________________________________________________
and get the output at the bottom when it runs. Maybe my java and Matlab aren't in
agreement on some paths or something? I really have no clue.

java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)

javac 1.5.0_16

when I type
getenv JAVA_HOME
ans =
      ''
even though I typed
set JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
in the command line.

maybe this is the problem? Is this the right path to the JDK on my mac? I didn't install it since it comes preinstalled, so I don't really know. And why won't it set the value.

I'm sorry to ramble on, I just want to show you what I have tried. I hate to be stuck fiddling with this when I would much rather be playing with my new toy that lets me use MATLAB in Java.


Preparing to not work in 3...2...1...
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to find the library libmwmclmcrrt.7.10.dylib, required by MATLAB Builder JA, on java.library.path

at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ProxyLibraryDir.get(MCRConfiguration.java:123)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ProxyLibraryDir.<clinit>(MCRConfiguration.java:126)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getProxyLibraryDir(MCRConfiguration.java:131)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$MCRRoot.get(MCRConfiguration.java:62)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$MCRRoot.<clinit>(MCRConfiguration.java:72)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getMCRRoot(MCRConfiguration.java:77)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ModuleDir.<clinit>(MCRConfiguration.java:51)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getModuleDir(MCRConfiguration.java:56)
at com.mathworks.toolbox.javabuilder.internal.MWMCR.<clinit>(MWMCR.java:1447)
at javaBuilderTest.JavaBuilderTestMCRFactory.<clinit>(JavaBuilderTestMCRFactory.java:98)
at javaBuilderTest.JavaBuilderTest.<init>(JavaBuilderTest.java:61)
at DisplayTest.main(DisplayTest.java:9)

Subject: Matlab Builder JA and eclipse

From: Johnathan

Date: 2 Jul, 2009 06:20:02

Message: 3 of 4

Ensure you have the version (1.6.0) of the Java Runtime Environment (JRE). See section
  5A.

I just saw this in the readme generated by the Builder. However I've heard that java 1.6 doesn't quite work on mac OSX. Is this the reason I'm having trouble? Do I have to have 1.6 period?

Sorry to keep posting, but I'd like to find the answer so I figure I'll report everything I see.

Subject: Matlab Builder JA and eclipse

From: Harpreet

Date: 13 Jul, 2009 21:35:04

Message: 4 of 4

I am also new to Matlab Builder JA but I also had the similar problem. I would suggest you have to have setup JAVA_HOME correctly before building the M-file. Once you setup JAVA_HOME in command prompt you have to restart the matlab and then check again I think because it worked for me.

"Johnathan " <durchfalldurchfall@yahoo.com> wrote in message <h2hj5d$l4j$1@fred.mathworks.com>...
> Just thought I would be a little more clear. I tried my own little code.
>
> I have an M-file:
> __________________________________________________________
> function JavaBuilderTest
> disp('the function worked and you are a big strong man')
> end
> __________________________________________________________
> which is placed in a .jar file javaBuilderTest.jar by the deployment tool.
> I have added the javaBuilderTest.jar and javabuilder.jar files to the build path as libraries.
>
> I have written this short class called DisplayTest.java:
>
> __________________________________________________________
> import com.mathworks.toolbox.javabuilder.*;
> import javaBuilderTest.*;
>
> public class DisplayTest
> {
> public static void main(String[] args) throws MWException
> {
> System.out.println("Preparing to not work in 3...2...1...");
> JavaBuilderTest MyObject = new JavaBuilderTest();
> }
> }
> __________________________________________________________
> and get the output at the bottom when it runs. Maybe my java and Matlab aren't in
> agreement on some paths or something? I really have no clue.
>
> java version "1.5.0_16"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
> Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)
>
> javac 1.5.0_16
>
> when I type
> getenv JAVA_HOME
> ans =
> ''
> even though I typed
> set JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
> in the command line.
>
> maybe this is the problem? Is this the right path to the JDK on my mac? I didn't install it since it comes preinstalled, so I don't really know. And why won't it set the value.
>
> I'm sorry to ramble on, I just want to show you what I have tried. I hate to be stuck fiddling with this when I would much rather be playing with my new toy that lets me use MATLAB in Java.
>
>
> Preparing to not work in 3...2...1...
> Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to find the library libmwmclmcrrt.7.10.dylib, required by MATLAB Builder JA, on java.library.path
>
> at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ProxyLibraryDir.get(MCRConfiguration.java:123)
> at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ProxyLibraryDir.<clinit>(MCRConfiguration.java:126)
> at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getProxyLibraryDir(MCRConfiguration.java:131)
> at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$MCRRoot.get(MCRConfiguration.java:62)
> at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$MCRRoot.<clinit>(MCRConfiguration.java:72)
> at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getMCRRoot(MCRConfiguration.java:77)
> at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ModuleDir.<clinit>(MCRConfiguration.java:51)
> at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getModuleDir(MCRConfiguration.java:56)
> at com.mathworks.toolbox.javabuilder.internal.MWMCR.<clinit>(MWMCR.java:1447)
> at javaBuilderTest.JavaBuilderTestMCRFactory.<clinit>(JavaBuilderTestMCRFactory.java:98)
> at javaBuilderTest.JavaBuilderTest.<init>(JavaBuilderTest.java:61)
> at DisplayTest.main(DisplayTest.java:9)

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
builder Johnathan 1 Jul, 2009 21:59:04
ja Johnathan 1 Jul, 2009 21:59:04
error Johnathan 1 Jul, 2009 21:59:04
eclipse Johnathan 1 Jul, 2009 21:59:04
rssFeed for this Thread

Contact us at files@mathworks.com