Why is my Java project using Matlab Runtime giving error?

6 ビュー (過去 30 日間)
Rozerin
Rozerin 2024 年 9 月 6 日
コメント済み: Rozerin 2024 年 9 月 9 日
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.
  1 件のコメント
Rozerin
Rozerin 2024 年 9 月 9 日
This answer solved my problem. Thank you so much.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeJava Package Integration についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by