Why is my java Command Line Application Crashing with QT Error on R2022b?

I am compiling a Command Line application from a Java Library generated from my Simulink Model with Library Compiler in R2022b. When I try to run the app, it crashes with the following error message:
Assertion failed: (This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: cocoa, minimal, offscreen, webgl.
Note that this workflow works without issue on previous releases (R2021b, R2022a).
How can I resolve this issue?

 採用された回答

MathWorks Support Team
MathWorks Support Team 2023 年 5 月 8 日
As your application is a command line, you can explicitly disable QT from loading.
To do so, in the root folder of your project, locate the main "<project_name>.java" file used to compile the app.
In this file, in the definition of the class <project_name>, in the "main" method, add the following line:
 MWApplication.initialize(MWMCROption.NODISPLAY)
This will prevent QT from loading and solve the issue.
For more information about MWApplication, see:

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with MATLAB Compiler SDK についてさらに検索

製品

リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by