- Did you correctly install the Java Runtime Environment? Here more details for apple silicon: https://www.mathworks.com/support/requirements/apple-silicon.html
- The library might be blocked by your antivirus, maybe you need to whitelist it in your security software
I get an error message while using a JAR that is compiled by Library Compiler
7 ビュー (過去 30 日間)
古いコメントを表示
I have a MATLAB project, which I compile using the MATLAB compiler to a JAR file and call from a Java project. I have been using the compiled file on Windows without any issues for a few years. Recently, I switched to Mac. Today, I decided to compile my Java project on Mac OS Sequoia. I compiled the MATLAB code on my Mac Studio with M2 Max processor and added to my Java project as a library as usual. However, I get the following error when I try to plot a graph using it:
java.lang.UnsatisfiedLinkError: Can't load library: /System/Library/Frameworks/gluegen-rt.Framework/gluegen-rt
I couldn't resolve the problem despite spending several hours on it. Could you help me with this problem?
0 件のコメント
採用された回答
Mathias
2025 年 3 月 6 日
編集済み: Mathias
2025 年 3 月 6 日
Hi Cagri,
For some reason the "gluegen-rt.jar" library cannot be loaded, as the error states. This library should be found here: <matlabroot>\java\jarext\gluegen-rt.jar where 'matlabroot' is the directory you get after running >>matlabroot in MATLAB.
Here a few ideas:
Since this is a graphics-related issue, you might also want to try turning off 'OpenGL'. This will probably result in lesser graphics performance, but it might get your jar running again. To do so, when compiling your jar, set the -noopengl flag. How to set a flag when compiling is detailed here:
Alternatively, in your Java code, initialize the MATLAB runtime in the following way, so that "noopengl" is used:
MWApplication.initialize(new MWMCROption(){public String[] toStringArray(){return new String[] {"-noopengl"};}});
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で C Shared Library Integration についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!