Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Can't find platform plugins when qt gets loaded by jni
Forum Updated to NodeBB v4.3 + New Features

Can't find platform plugins when qt gets loaded by jni

Scheduled Pinned Locked Moved Installation and Deployment
3 Posts 3 Posters 862 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jjjjj
    wrote on last edited by
    #1

    Hello

    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.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      at1970
      wrote on last edited by
      #2

      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";
      a.addLibraryPath(pluginsPath);

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        What's your deployment target ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved