Use of JavaBuilder to Build Java-Matlab Related Application on MAC or WIndows
조회 수: 8 (최근 30일)
이전 댓글 표시
Hi Everyone, I've had the hardest time getting anything compiled builder JA to work with Netbeans IDE on JAVA 1.6 in both MAC OSX 10.6.8 (snow leopard) or Windows XP. I can't even do the basic makesqr.m tutorial.
All of the documentation on getting builderJA is just scattered, and I can no longer make heads or tails of any resource left on the web, so I found it best to come here and ask. I receive the following error when compiling the JAVA example using the makesquare class example (MLTestClass.class).
Exception in thread "main" java.lang.ExceptionInInitializerError
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.demo3.Demo3MCRFactory.newInstance(Demo3MCRFactory.java:49)
at com.demo3.Demo3MCRFactory.newInstance(Demo3MCRFactory.java:60)
at com.demo3.MLTestClass.<init>(MLTestClass.java:63)
at matlabtestapplication.MatlabTestApplication.main(MatlabTestApplication.java:21)
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:173)
... 11 more
Java Result: 1
On Mac, I've set up the DYLD_LIBRARY_PATH to include the MCR, but it resets every time, whether I use the matlab setenv command, or use the terminal with bash with export, or use setenv with csh terminal.
The same with the JAVA_HOME variable. How can I set these permanently in mac?
On Windows, I've set up the PATH environmental variable and JAVA_HOME correctly through the system,advanced, env. variables. I get the following error:
"Failed to find the library mclmcrrt713.dll on the java.library.path" when building the code in Netbeans (for windows).
How can I set the java.library.path? I've already set all the variables in netbeans to point to the matlab MCR, (the CORRECT version of MCR).
댓글 수: 0
답변 (1개)
Eoin
2012년 2월 15일
Hi Joseph,
Have you managed to figure this out yet? I've started using java as well now and am encountering problems.
I was getting the error "Failed to find the library mclmcrrt713.dll on the java.library.path" on windows as well. It turns out my problem was that the matlab jar i created was created on a 64-bit version, but the runtime i was running it under in java was a 32 bit runtime. When i changed the runtime to 64 bit it worked ok. Hope that helps?
However, I also work on a MAC and am getting the first error you showed above. I have copied the javabuilder.jar file from the matlabroot\toolbox\javabuilder\jar\maci64 folder from my windows machine and put it on my MAC and reference it as an external jar but I still get this error. I've searched on my MAC for another version of javabuilder but can't find one.
댓글 수: 2
Friedrich
2012년 2월 15일
You get this error when your environment variables are not setup correctly. Which are requiered can be found here:
http://www.mathworks.com/help/toolbox/compiler/bqrw4o0-1.html#bqrxhm4-1
Friedrich
2012년 2월 15일
Regarding your windows bitness issue: The javabuilder.jar for win32 != javabuilder.jar for win64.But they should be interchangable seen from the Java application though.So you could run against a different bitness MCR but you need to use the javabuilder.jar from that MCR then.
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!