Java – Call Java functions from Qt C++

Call Java functions from Qt C++… here is a solution to the problem.

Call Java functions from Qt C++

Is it possible to call java functions from a Qt application? If so, how? Do I need to update the java source code for such a task? I have Qt Desktop Open Source.

Solution

First, think twice before calling Java from C/C++. For Android, it allows you to call some API functions of the operating system, but at the cost of performance and some hard-to-catch errors.

Qt devises a very simple way to call Java: package – androidextra
But if you need to call it on the desktop, there’s one way to avoid it: JNI (as Nejat puts it).

Here is a simple example of using it:
http://www.codeproject.com/Articles/22881/How-to-Call-Java-Functions-from-C-Using-JNI

Related Problems and Solutions