Reputation: 31
I am working on a mixed C++/Qt/Java application. I am opening a QtSplashScreen from the C++ side before starting the JVM using JNI. My problem comes when closing the QtSplashScreen. I would like to have a callback on the C++ side that gets called by the Java side when the application is ready to run. However, it seems that when calling C++ from Java using either JNI or JNA I need to compile the C++ code as a shared library, which breaks all the QtSplashScreen internal dependencies. Any ideas?
Thanks.
Upvotes: 1
Views: 837
Reputation: 21
I'm the original poster. In the end the solution was to use JNI to call a Java method that returns a boolean. This method uses wait() to wait until the Java side is ready. When that happens, the app calls notifyAll() on the same object and the method returns, which makes the SplashScreen close, as in:
waitForJava(); splashScreen.close();
Upvotes: 0
Reputation: 25725
Ok totally silly way - but I would implement splashscreen and the java program as separate processes spawned by a common parent process. I would then have it communicate with each other over UDP(simplest) or with Mailboxes/Pipes.
IMHO, when you need communication between programs written in different programming languages, you must separate the process itself, and have it communicate with each other over TCP/UDP/Mailboxes/IPC(or similar concepts).
Upvotes: 6