Calling matlab function from java several times
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Call Java from MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!