Can't find platform plugins when qt gets loaded by jni
jjjjj last edited by
So this is a variant of the "failed to load platform plugin" issue with the Qt platform abstraction. I have a C++ Library which depends on the Qt Framework. Everything works when I create a C++ Application and call the library with the Qt Dependencies in the project folder.
But when I create a JNI and set the JVM to load the Library, I get the standard error "This application failed to start because it could not find or load the Qt platform plugin X", even though all dependencies + the platforms folder are in the same directory.
I read the qt 4.8 deployment doc to plugins (http://qt-project.org/doc/qt-4.8/deployment-plugins.html) and I guess the problem is that "QCoreApplication::applicationDirPath() " is not pointing to the right directory. I tried setting the QT_PLUGIN_PATH environment variable but it didn't have any effect.
What am I doing wrong? I am certainly not the first one to use Qt and JNI.
at1970 last edited by
try collect all required plugins in one folder (e.g. /plugins near executed file) and set folder in main.cpp like
QApplication a(argc, argv);
QString pluginsPath = a.applicationDirPath()+"/plugins";
Hi and welcome to devnet,
What's your deployment target ?