Calling matlab function from java several times
3 次查看(过去 30 天)
显示 更早的评论
We are calling MatLab methods from a Java Web-service using two different jar files that each load the MatLab runtime libraries. This causes the Java Virtual Machine to load the libraries twice. The result is the following error the second time the MatLab libraries are loaded.
Exception in thread "Thread-55" java.lang.UnsatisfiedLinkError: Native Library C:\Program Files\MATLAB\MATLAB Runtime\v92\bin\win64\BuilderJABootstrap.dll already loaded in another classloader
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.mathworks.toolbox.javabuilder.internal.MWMCR.<clinit>(MWMCR.java:1699)
at com.mathworks.toolbox.javabuilder.MWUtil.GetUnknownClassID(MWUtil.java:727)
at com.mathworks.toolbox.javabuilder.MWClassID.<clinit>(MWClassID.java:43)
at com.mathworks.toolbox.javabuilder.MWCharArray.<init>(MWCharArray.java:81)
at com.simfinit.SimServiceReport.SimServiceReportThread.exportReport(SimServiceReportThread.java:255)
at com.simfinit.SimServiceReport.SimServiceReportThread.threadDriverReport(SimServiceReportThread.java:188)
We have tried putting an instantiation of the MWCharArray class into a static Java class to pre-load the libraries before calling methods in the MatLab jar file, but this did not avoid the problem. We have also considered putting both Matlab applications into a single jar file, or to unload the MatLab dlls after each use. If there is a known solution to this issue, we would appreciate some advice.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Java from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!