Why is my Java project using Matlab Runtime giving error?

6 vues (au cours des 30 derniers jours)
Rozerin
Rozerin le 6 Sep 2024
Commenté : Rozerin le 9 Sep 2024
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?

Réponse acceptée

Kojiro Saito
Kojiro Saito le 7 Sep 2024
Modifié(e) : Kojiro Saito le 7 Sep 2024
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 commentaire
Rozerin
Rozerin le 9 Sep 2024
This answer solved my problem. Thank you so much.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Java Package Integration dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by