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?

 Accepted Answer

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:

More Answers (0)

Categories

Products

Release

R2022b

Community Treasure Hunt

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

Start Hunting!