Why is my Java project using Matlab Runtime giving error?

6 次查看(过去 30 天)
I have a Java project that using Matlab Runtime (R2018a (9.4)) and i add the path to pom.xml like this:
<javabuilder.path>C:\Program Files\MATLAB\MATLAB Runtime\v94\toolbox\javabuilder\jar\javabuilder.jar</javabuilder.path>
I can run this project without any error. After that, i need to hava .jar file. And then, i run this to get jar file:
mvn clean install
And i could get the .jar file without any error too. However, when i started to run this jar file i get this error:
WARN 22684 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'be3D_PD' defined in URL [jar:file:/C:/Users/user/Desktop/GitHub/Project/polys/fea/target/demo1-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/dynamics/Be3D_PD.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [dynamics.so3D_PD]: Constructor threw exception; nested exception is java.lang.UnsatisfiedLinkError: Failed to find the required library mclmcrrt9_4.dll on java.library.path.
This library is typically installed along with MATLAB or the MATLAB Runtime. Its absence may indicate an issue with that installation or
the current path configuration, or a mismatch with the architecture of the Java interpreter on the path.
MATLAB Runtime version this component is attempting to use: 9.4.
Java interpreter architecture: win64.
I don't understand why i get this error, even the project could run before jar file. Why can not find mclmcrrt9_4.dll?

采纳的回答

Kojiro Saito
Kojiro Saito 2024-9-7
编辑:Kojiro Saito 2024-9-7
mclmcrrtX_X.dll is located in <MATLAB_Runtime_Root>\runtime\win64.
You might need to add C:\Program Files\MATLAB\MATLAB Runtime\v94\runtime\win64 to Windows Path enviroment in Command Prompt,
set PATH=%PATH%;C:\Program Files\MATLAB\MATLAB Runtime\v94\runtime\win64
before running the deployed java application.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Java Package Integration 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by