Results 1 to 4 of 4
  1. #1
    jsparger is offline Member
    Join Date
    Jul 2009
    Posts
    3
    Rep Power
    0

    Default Loading a .dylib for Matlab Compiler STUCK!

    Well, I got a brand new toy, the MATLAB Builder JA, but it refuses to work for me when I try and use it in Java.

    I'm using eclipse.

    I will skip the MATLAB part unless anyone thinks it is important.
    com.mathworks.toolbox.javabuilder.* comes from javabuilder.jar which is part of the Matlab Libraries needed for this to work and javaBuilderTest.* comes from javaBuilderTest.jar, which is the class that I created using the compiler. They are set as external jars in eclipse.

    Here is the code I started out with:

    /////////////////////////////////////////////////////////////////////////////
    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 I received the following delicious output:

    /////////////////////////////////////////////////////////////////////////////
    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.MCRConf iguration$ProxyLibraryDir.get(MCRConfiguration.jav a:123)
    at com.mathworks.toolbox.javabuilder.internal.MCRConf iguration$ProxyLibraryDir.<clinit>(MCRConfiguratio n.java:126)
    at com.mathworks.toolbox.javabuilder.internal.MCRConf iguration.getProxyLibraryDir(MCRConfiguration.java :131)
    at com.mathworks.toolbox.javabuilder.internal.MCRConf iguration$MCRRoot.get(MCRConfiguration.java:62)
    at com.mathworks.toolbox.javabuilder.internal.MCRConf iguration$MCRRoot.<clinit>(MCRConfiguration.java:7 2)
    at com.mathworks.toolbox.javabuilder.internal.MCRConf iguration.getMCRRoot(MCRConfiguration.java:77)
    at com.mathworks.toolbox.javabuilder.internal.MCRConf iguration$ModuleDir.<clinit>(MCRConfiguration.java :51)
    at com.mathworks.toolbox.javabuilder.internal.MCRConf iguration.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>(JavaBuilder Test.java:61)
    at DisplayTest.main(DisplayTest.java:14)

    /////////////////////////////////////////////////////////////////////////////

    so in my infinite wisdom I tried this code:

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

    public class DisplayTest
    {

    public static void main(String[] args) throws MWException
    {
    String path = new String("/Applications/MATLAB/MATLAB_Compiler_Runtime/v710/runtime/maci/libmwmclmcrrt.7.10.dylib ");
    System.out.println(path);
    System.out.println(System.getProperty("java.librar y.path"));
    System.load(path);
    System.out.println("Preparing to not work in 3...2...1...");
    JavaBuilderTest MyObject = new JavaBuilderTest();

    }
    }


    /////////////////////////////////////////////////////////////////////////////

    And got this output:

    /////////////////////////////////////////////////////////////////////////////
    /Applications/MATLAB/MATLAB_Compiler_Runtime/v710/runtime/maci/libmwmclmcrrt.7.10.dylib
    .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java

    Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /Applications/MATLAB/MATLAB_Compiler_Runtime/v710/runtime/maci/libmwmclmcrrt.7.10.dylib
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java :1705)
    at java.lang.Runtime.load0(Runtime.java:770)
    at java.lang.System.load(System.java:1005)
    at DisplayTest.main(DisplayTest.java:12)

    /////////////////////////////////////////////////////////////////////////////

    So I'm not sure what I need to do. That is clearly the path of the library. I copied it and pasted it, and it shows up in terminal. UnsatisfiedLinkError is the error thrown when it the file doesn't exist, correct?

    Please help me out. This is getting pretty annoying. Am I loading the file correctly?

    Thanks
    --John

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Have you set Eclipse to recognize the JAR files by placing them in the "Build Path"?

  3. #3
    jsparger is offline Member
    Join Date
    Jul 2009
    Posts
    3
    Rep Power
    0

    Default

    yes, I set them as external jars under buid path > libraries. Do I have to do something similar for libmwmclmcrrt.7.10.dylib?

  4. #4
    jsparger is offline Member
    Join Date
    Jul 2009
    Posts
    3
    Rep Power
    0

Similar Threads

  1. run a matlab script from java
    By npoorni in forum Advanced Java
    Replies: 5
    Last Post: 02-11-2010, 04:32 PM
  2. compiler,JIT compiler & interpreter
    By gamilah in forum New To Java
    Replies: 4
    Last Post: 11-04-2008, 01:32 AM
  3. Help, Integrate a Java with Matlab
    By toby in forum Advanced Java
    Replies: 2
    Last Post: 08-07-2008, 08:08 AM
  4. Replies: 3
    Last Post: 04-10-2008, 10:01 AM
  5. Replies: 1
    Last Post: 08-07-2007, 06:37 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •