From: Stefan Roth on
Hi

I recently wanted to compile and run javabuilder components on a Mac (OS X.5.8). However I continuously get the following exception as soon as I want to instantiate a Matlab related class (see test code and exception at the end of the message) in my Eclipse environment.

CONFIGURATION:

MATLAB:
- Matlab 2009b (64bit) - 7.9.0.529

version('java') in Matlab returns:
- Java 1.6.0_17-b04-248-9M3125 with Apple Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode

ECLIPSE:
- Build id: 20100218-1602

- javabuilder.jar added as external jar file

According to readme.txt create by Matlabs deploymentool
(* Ensure you have the version (1.6.0) of the Java Runtime Environment (JRE).), I have set:
- JVM 1.6.0 as the JRE used in Eclipse and changed the compiler settings accordingly.

MAC ENV:
Additionally I created the two environment variables:
Maci64
setenv DYLD_LIBRARY_PATH
<mcr_root>/v711/runtime/maci64:
<mcr_root>/v711/sys/os/maci64:
<mcr_root>/v711/bin/maci64:
/System/Library/Frameworks/JavaVM.framework/JavaVM:
/System/Library/Frameworks/JavaVM.framework/Libraries
setenv XAPPLRESDIR <mcr_root>/v711/X11/app-defaults

Without any success, I alwaysget the exception below and can neither use any of my own components, nor instantiate one of the built in Matlab data classes (see test code).

What's wrong with my configuration?

Thanks a lot for any help, I really run out of ideas...

Stefan



TEST CODE:

public static void main(String[] args) {
MWNumericArray test = new MWNumericArray();

}

EXCEPTION:

Exception in thread "main" java.lang.ExceptionInInitializerError
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getProxyLibraryDir(MCRConfiguration.java:157)
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:1575)
at com.mathworks.toolbox.javabuilder.MWUtil.GetUnknownClassID(MWUtil.java:727)
at com.mathworks.toolbox.javabuilder.MWClassID.<clinit>(MWClassID.java:41)
at com.mathworks.toolbox.javabuilder.MWNumericArray.<init>(MWNumericArray.java:26)
at test.Test.main(Test.java:12)
Caused by: java.lang.NullPointerException
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ProxyLibraryDir.get(MCRConfiguration.java:143)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ProxyLibraryDir.<clinit>(MCRConfiguration.java:152)
... 11 more
From: Jennie on
"Stefan Roth" <sro(a)ini.phys.ethz.ch> wrote in message <hqn5pk$3gi$1(a)fred.mathworks.com>...
> Hi
>
> I recently wanted to compile and run javabuilder components on a Mac (OS X.5.8). However I continuously get the following exception as soon as I want to instantiate a Matlab related class (see test code and exception at the end of the message) in my Eclipse environment.
>


I am trying to do the same thing - though I set my environment variables a bit differently. I added the LSEnvironment dictionary key to the Info.plist for Eclipse and set DYLD_LIBRARY_PATH and XAPPLRESDIR there. The exception I get now is this:

java.lang.LinkageError: dlopen(/Applications/MATLAB/MATLAB_Compiler_Runtime/v713/bin/maci64/libnativemcl.jnilib, 9): Library not loaded: libtbb.dylib
Referenced from: /Applications/MATLAB/MATLAB_Compiler_Runtime/v713/bin/maci64/libmwfl.dylib
Reason: image not found
at com.mathworks.toolbox.javabuilder.internal.DynamicLibraryUtils.dlopen(Native Method)
at com.mathworks.toolbox.javabuilder.internal.DynamicLibraryUtils.loadLibraryAndBindNativeMethods(DynamicLibraryUtils.java:131)
at com.mathworks.toolbox.javabuilder.internal.MWMCR.<clinit>(MWMCR.java:1574)

It appears that at some level the DYLD_LIBRARY_PATH is being read, but it is not being passed down the line?

Jennie
From: Jennie on
"Jennie " <jcochran(a)adconion.com> wrote in message

Correction: Eclipse appears to ignore the LSEnvironment key. XAPPLRESDIR was set inside ~/.MacOSX/environment.plist. However setting DYLD_LIBRARY_PATH inside environment.plist is forbidden for security reasons.

>
> I am trying to do the same thing - though I set my environment variables a bit differently. I added the LSEnvironment dictionary key to the Info.plist for Eclipse and set DYLD_LIBRARY_PATH and XAPPLRESDIR there. The exception I get now is this:
>
> java.lang.LinkageError: dlopen(/Applications/MATLAB/MATLAB_Compiler_Runtime/v713/bin/maci64/libnativemcl.jnilib, 9): Library not loaded: libtbb.dylib
> Referenced from: /Applications/MATLAB/MATLAB_Compiler_Runtime/v713/bin/maci64/libmwfl.dylib
> Reason: image not found
> at com.mathworks.toolbox.javabuilder.internal.DynamicLibraryUtils.dlopen(Native Method)
> at com.mathworks.toolbox.javabuilder.internal.DynamicLibraryUtils.loadLibraryAndBindNativeMethods(DynamicLibraryUtils.java:131)
> at com.mathworks.toolbox.javabuilder.internal.MWMCR.<clinit>(MWMCR.java:1574)
>
> It appears that at some level the DYLD_LIBRARY_PATH is being read, but it is not being passed down the line?
>
> Jennie