Why do I receive "wrong ELF class" errors when running my application created with MATLAB Builder for Java 1.1 (R2007a) on 64-bit Solaris?

I have created a Java class using MATLAB Builder for Java 1.1 (R2007a) on my Solaris machine. I then created a Java program to call methods of this class. However when I execute the Java program I receive the following error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: /devel/archive/R2007a/ship/unix/dist/bin/sol64/libnativemcl76.so: ld.so.1: /devel/archive/R2007a/ship/unix/dist/sys/java/jre/sol64/jre1.5.0/bin/java: fatal: /devel/archive/R2007a/ship/unix/dist/bin/sol64/libnativemcl76.so: wrong ELF class: ELFCLASS64
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.mathworks.toolbox.javabuilder.MWMCR.<clinit>(MWMCR.java:25)
at helloworld_jb_sol64.helloworld_jb_sol64class.<init>(helloworld_jb_sol64class.java:47)
at callHelloWorld.main(callHelloWorld.java:7)

 采纳的回答

The documentation for MATLAB 7.6 (R2008b) has been updated with relevant information. For previous product releases, please read below for any possible workarounds:
There is an omission in the documentation for MATLAB Builder for Java 1.1 (R2007a) relating to the command needed to execute the Java program which calls a Java class created with MATLAB Builder for Java on 64-bit Solaris platforms.
The documentation should say that on 64-bit Solaris machines, you need to include the -d64 flag in the Java command used to run the application. This is because by default the Java Virtual Machine (JVM) starts in 32-bit client mode on 64-bit Solaris machines and the MATLAB Component Runtime (MCR) requires a 64-bit JVM. For example when running the magic square example from the documentation you should use the following command:
matlabroot/sys/java/jre/architecture/jre_directory/bin/java -classpath .:matlabroot/toolbox/javabuilder/jar/javabuilder.jar:MagicDemoJavaApp/magicsquare/distrib/magicsquare.jar -d64 getmagic 5

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Get Started with MATLAB Compiler SDK 的更多信息

产品

版本

R2007a

标签

尚未输入任何标签。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by