<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Qt Java function call via JNI]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I am currently working on a Qt desktop application (Qt 5.15) where we would like to make some function calls from a Java application(jar file). It seems that using JNI could be a nice way to do that quickly instead of building an IPC mechanism.</p>
<p dir="auto">But after some research, I realized that the JNI is currently available only on Qt Android Extras module and we want to use JNI functions on our desktop application. Is there a different way to do that and take advantage of the QAndroidJniObject ? Any other ideas/alternatives on how to do that integration quickly between two applications? Also, I think that in Qt6 maybe it is possible to use JNI in other platforms other than Android but I am not very sure about that.</p>
<p dir="auto">Thanks!</p>
]]></description><link>https://forum.qt.io/topic/132135/qt-java-function-call-via-jni</link><generator>RSS for Node</generator><lastBuildDate>Tue, 04 Aug 2026 13:41:16 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/132135.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 19 Nov 2021 11:50:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Qt Java function call via JNI on Fri, 19 Nov 2021 14:57:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/nsourl">@<bdi>nsourl</bdi></a><br />
yes, any IPC mechnism is applicable for you.<br />
<a href="https://doc.qt.io/qt-5/ipc.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/ipc.html</a><br />
I would say take the one which integrates the easiest for your needs on both sides.<br />
For example TCP/IP works in all frameworks and systems, but requires to setup a custom protocol for data transfer.</p>
<p dir="auto">Or use a RPC lib as you mentioned.</p>
]]></description><link>https://forum.qt.io/post/690855</link><guid isPermaLink="true">https://forum.qt.io/post/690855</guid><dc:creator><![CDATA[raven-worx]]></dc:creator><pubDate>Fri, 19 Nov 2021 14:57:09 GMT</pubDate></item><item><title><![CDATA[Reply to Qt Java function call via JNI on Fri, 19 Nov 2021 14:28:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/nsourl">@<bdi>nsourl</bdi></a>, that's easy! Create two application, one with Java and another with Qt and have send/receive in each of those. I did that once between an android (Java) app and C# for testing.</p>
]]></description><link>https://forum.qt.io/post/690853</link><guid isPermaLink="true">https://forum.qt.io/post/690853</guid><dc:creator><![CDATA[deleted385]]></dc:creator><pubDate>Fri, 19 Nov 2021 14:28:44 GMT</pubDate></item><item><title><![CDATA[Reply to Qt Java function call via JNI on Fri, 19 Nov 2021 14:11:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/raven-worx">@<bdi>raven-worx</bdi></a></p>
<p dir="auto">thanks for your reply and as you said I had misunderstood the JNI usability. I was thinking that it could be something more generic but it isn't.</p>
<p dir="auto">Do you have something in mind to suggest as a solution in my case? A classic C++ and Java socket communication could be a nice option? Or something more advanced like gRPC could be more useful?</p>
<p dir="auto">Thanks.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/raven-worx">@<bdi>raven-worx</bdi></a> said in <a href="/post/690846">Qt Java function call via JNI</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/nsourl">@<bdi>nsourl</bdi></a><br />
i think you missunderstood the mechanics of JNI.<br />
Qt JNI works on Android because the Qt app also runs inside the JAVA engine.</p>
<p dir="auto">You cannot use JNI to call any JAVA method in a Desktop environment.</p>
</blockquote>
]]></description><link>https://forum.qt.io/post/690849</link><guid isPermaLink="true">https://forum.qt.io/post/690849</guid><dc:creator><![CDATA[nsourl]]></dc:creator><pubDate>Fri, 19 Nov 2021 14:11:00 GMT</pubDate></item><item><title><![CDATA[Reply to Qt Java function call via JNI on Fri, 19 Nov 2021 13:53:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/nsourl">@<bdi>nsourl</bdi></a><br />
i think you missunderstood the mechanics of JNI.<br />
Qt JNI works on Android because the Qt app also runs inside the JAVA engine.</p>
<p dir="auto">You cannot use JNI to call any JAVA method in a Desktop environment.</p>
]]></description><link>https://forum.qt.io/post/690846</link><guid isPermaLink="true">https://forum.qt.io/post/690846</guid><dc:creator><![CDATA[raven-worx]]></dc:creator><pubDate>Fri, 19 Nov 2021 13:53:13 GMT</pubDate></item></channel></rss>