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!