java - 在使用 Matlab 中的库编译器打包的 java 中运行 Matlab 代码时出现库错误
问题描述
我已经使用“deploytool”命令将 MATLAB 代码编译为 Java 包。在 Java 中使用库时,我收到错误,因为找不到库,如下所示。
我使用的是 Java 1.8.0_144,64 位,MATLAB 是 64 位,用于运行库的 java 也是 64 位。我在 intellij 设置的库部分中包含了 JavaBuilder.jar 和我的 MATLAB jar。我还在资源、类路径中加载“mclmcrrt9_4.dll”文件,也通过使用加载它
System.loadLibrary("mclmcrrt9_4");
关于此方法或将 MATLABcode 转换为 java 的任何其他方法的任何帮助都是有帮助的
错误:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: 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.
解决方案
推荐阅读
- java - Camunda 在启动期间在本地 oracle db 上引发错误
- java - 将箭头图标更改为汉堡图标
- react-native - 在运行 e2e 测试之前如何不重建反应原生应用程序?
- php - Mysql如何推断数据并放入数组?
- python - 如何使用 Folium 在“鼠标悬停”上突出显示世界国家边界?
- java - 如何在 Java 中同时录制麦克风和扬声器的音频?
- html - 服务器返回 HTML 而不是预期的 JSON 响应
- c# - 迁移到 Visual Studio 2017 后,在 ASP.NET MVC 项目中出现构建错误
- javascript - JS 'body.forEach 不是函数' 上的错误
- python - 聚类后从 k-means 聚类中获取值