<div dir="ltr">Unless I misunderstand the discussion here, the plugins [1][2] Nir refers to are exactly created to solve the original problem. For reasons Phil explains very well, we do need different jars for different platforms. <div><br><div>The maven and gradle plugins take away the task from the developer to specify what platform is used at runtime. No need to use all jars on a single platform.</div><div><br></div><div>How to use them is explained at <a href="https://openjfx.io/openjfx-docs/#maven">https://openjfx.io/openjfx-docs/#maven</a> --note that you do not specify the classifier in the end-user pom.xml</div><div><br></div><div>- Johan</div><div><br></div><div>[1] Gradle variant - <a href="https://github.com/openjfx/javafx-gradle-plugin">https://github.com/openjfx/javafx-gradle-plugin</a></div><div><br></div><div>[2] Maven variant - <a href="https://github.com/openjfx/javafx-maven-plugin">https://github.com/openjfx/javafx-maven-plugin</a></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Op vr 21 okt. 2022 om 00:39 schreef Nir Lisker <<a href="mailto:nlisker@gmail.com">nlisker@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">It doesn't look to me like a big problem, regardless of the size of the project. You just include the modules you want depending on what your application needs and which platforms it targets. In Gradle, it's just 2 lines of code.<div><br></div><div>There is also the JavaFX plugin that might help with this, but it's unrelated to the development here:</div><div>Gradle variant - <a href="https://github.com/openjfx/javafx-gradle-plugin" target="_blank">https://github.com/openjfx/javafx-gradle-plugin</a><br></div><div>Maven variant - <a href="https://github.com/openjfx/javafx-maven-plugin" target="_blank">https://github.com/openjfx/javafx-maven-plugin</a><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 21, 2022 at 1:29 AM Thomas Reinhardt <<a href="mailto:thomas.reinhardt@s4p.de" target="_blank">thomas.reinhardt@s4p.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Thanks Nir for the links to the other discussions. I got the thing to run with the simple approach of including all artifacts. Probably did miss some before but it's late in the night here :)</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
One thing that still bugs me is that I have to do dependency resolution manually if I want to include artifacts for different platforms. Not a huge problem but far from a perfect solution. And I can't stop to think what other big projects are doing. Apart
from toy-applications that run on the development system only, everybody should have the same problems I had. Or maybe I am just the last one striving for a platform independent application.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Thank you all for helping out! </div>
<div id="m_2602705972957366002m_-1170516679322364524signature_bookmark"></div>
<div id="m_2602705972957366002m_-1170516679322364524appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<hr style="display:inline-block;width:98%">
<div id="m_2602705972957366002m_-1170516679322364524divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Nir Lisker <<a href="mailto:nlisker@gmail.com" target="_blank">nlisker@gmail.com</a>><br>
<b>Sent:</b> 20 October 2022 23:14<br>
<b>To:</b> Thomas Reinhardt <<a href="mailto:thomas.reinhardt@s4p.de" target="_blank">thomas.reinhardt@s4p.de</a>><br>
<b>Cc:</b> <a href="mailto:openjfx-dev@openjdk.org" target="_blank">openjfx-dev@openjdk.org</a> <<a href="mailto:openjfx-dev@openjdk.org" target="_blank">openjfx-dev@openjdk.org</a>><br>
<b>Subject:</b> Re: Platform independent deployment</font>
<div> </div>
</div>
<div>
<div dir="ltr">There was a discussion on this some years ago, it started here: <a href="https://mail.openjdk.org/pipermail/openjfx-dev/2018-April/021762.html" target="_blank">
https://mail.openjdk.org/pipermail/openjfx-dev/2018-April/021762.html</a> (and continued in <a href="https://mail.openjdk.org/pipermail/openjfx-dev/2018-May/021774.html" target="_blank">https://mail.openjdk.org/pipermail/openjfx-dev/2018-May/021774.html</a>).
<div>There might have been another discussion after that, I don't remember.</div>
<div><br>
</div>
<div>Thomas, the graphics, media, and web modules contain OS-specific libraries. You will need to do what I showed for any of these that you use.</div>
</div>
<br>
<div>
<div dir="ltr">On Fri, Oct 21, 2022 at 12:05 AM Thomas Reinhardt <<a href="mailto:thomas.reinhardt@s4p.de" target="_blank">thomas.reinhardt@s4p.de</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="background-color:rgb(255,255,255);display:inline">Interesting. I will repeat my test more carefully. Maybe I am just doing something incredible stupid. But Andy has a good point: why include the java classes at all in the platform-specific jars
- shouldn't they just contain the native libraries if all the java code is indeed the same?</span><br>
</div>
<div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span> -Thomas</span><br>
</div>
</div>
<div id="m_2602705972957366002m_-1170516679322364524x_m_1573706237619046548signature_bookmark"></div>
<div id="m_2602705972957366002m_-1170516679322364524x_m_1573706237619046548appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<hr style="display:inline-block;width:98%">
<div id="m_2602705972957366002m_-1170516679322364524x_m_1573706237619046548divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> openjfx-dev <<a href="mailto:openjfx-dev-retn@openjdk.org" target="_blank">openjfx-dev-retn@openjdk.org</a>>
on behalf of Andy Goryachev <<a href="mailto:andy.goryachev@oracle.com" target="_blank">andy.goryachev@oracle.com</a>><br>
<b>Sent:</b> 20 October 2022 22:53<br>
<b>To:</b> John Hendrikx <<a href="mailto:john.hendrikx@gmail.com" target="_blank">john.hendrikx@gmail.com</a>>;
<a href="mailto:openjfx-dev@openjdk.org" target="_blank">openjfx-dev@openjdk.org</a> <<a href="mailto:openjfx-dev@openjdk.org" target="_blank">openjfx-dev@openjdk.org</a>><br>
<b>Subject:</b> Re: Platform independent deployment</font>
<div> </div>
</div>
<div lang="EN-US">
<div>
<p style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt;font-family:"Courier New"">Good point - are we packaging platform-specific javafx parts incorrectly?</span></p>
<p style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt;font-family:"Courier New""> </span></p>
<p style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt;font-family:"Courier New"">-andy</span></p>
<p style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt;font-family:"Courier New""> </span></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0in 0in">
<p style="margin:0in 0in 12pt;font-size:10pt;font-family:Calibri,sans-serif"><b><span style="font-size:12pt;color:black">From:
</span></b><span style="font-size:12pt;color:black">openjfx-dev <<a href="mailto:openjfx-dev-retn@openjdk.org" target="_blank">openjfx-dev-retn@openjdk.org</a>> on behalf of John Hendrikx <<a href="mailto:john.hendrikx@gmail.com" target="_blank">john.hendrikx@gmail.com</a>><br>
<b>Date: </b>Thursday, 2022/10/20 at 13:03<br>
<b>To: </b><a href="mailto:openjfx-dev@openjdk.org" target="_blank">openjfx-dev@openjdk.org</a> <<a href="mailto:openjfx-dev@openjdk.org" target="_blank">openjfx-dev@openjdk.org</a>><br>
<b>Subject: </b>Re: Platform independent deployment</span></p>
</div>
<div>
<p style="margin:0in;font-size:10pt;font-family:Calibri,sans-serif"><span style="font-size:11pt">Correct me if I'm wrong, but all the classes in the artifacts for win,
<br>
linux and mac are actually exactly the same -- this is Java code after <br>
all, why would all Java classes for a platform be platform specific? It <br>
doesn't matter which one is packaged. The platform specific stuff lives <br>
in the native libraries -- my shaded jar just includes all of them for <br>
all platforms (dll for windows, so for linux, dylib for mac). I'm <br>
pretty sure I used this exact same jar to run my software on windows and <br>
linux. Never tested mac as I don't own one.<br>
<br>
My pom therefore includes all three, like Nir Lisker has, and my shaded <br>
artifact just packages them all (I get a lot of warnings about duplicate <br>
classes, but those can just be ignored).<br>
<br>
--John<br>
<br>
On 20/10/2022 19:03, Thomas Reinhardt wrote:<br>
><br>
> Hi Nir,<br>
><br>
> Does not work (I testet it) and it can not work (see below).<br>
><br>
> Also, this is exactly what my naive test was (I did not use maven to <br>
> copy the artifacts, but the result obviously is the same).<br>
><br>
> It can not work as the implementation classes have the same name and <br>
> thus the jre can not distinguish which one to load. For example both <br>
> javafx-web-18-win and javafx-web-18-linux define a class <br>
> "javafx.scene.web.WebEngine". From the jre's point of view they are <br>
> the same.<br>
><br>
> What would be needed is<br>
><br>
> Either: a class "javafx.scene.web.WebEngine" that is only a thin <br>
> wrapper to javafx.scene.web.linux.WebEngine.<br>
><br>
> Or: a class that loads only one of the implementations during <br>
> application startup (technically it could load both implementations <br>
> with different classloaders, but lets not go there).<br>
><br>
> There might be other solutions but I am not aware of any.<br>
><br>
><br>
> I was looking for a help forum but did only find the #introduction <br>
> link you mentioned.<br>
><br>
><br>
> -Thomas<br>
><br>
><br>
><br>
> On 20/10/2022 17:52, Nir Lisker wrote:<br>
>> Hi Thomas,<br>
>><br>
>> Did you try to just specify the platform-specific dependencies in the <br>
>> POM?<br>
>><br>
>> <dependency><br>
>> <groupId>org.openjfx</groupId><br>
>> <artifactId>javafx-graphics</artifactId><br>
>> <version>19</version><br>
>> <classifier>win</classifier><br>
>> </dependency><br>
>> <dependency><br>
>> <groupId>org.openjfx</groupId><br>
>> <artifactId>javafx-graphics</artifactId><br>
>> <version>19</version><br>
>> <classifier>linux</classifier><br>
>> </dependency><br>
>> <dependency><br>
>> <groupId>org.openjfx</groupId><br>
>> <artifactId>javafx-graphics</artifactId><br>
>> <version>19</version><br>
>> <classifier>mac</classifier><br>
>> </dependency><br>
>><br>
>> Seems more of a question for help forums, though if this information <br>
>> is not mentioned in <a href="https://openjfx.io/openjfx-docs/#introduction" target="_blank">
https://openjfx.io/openjfx-docs/#introduction</a> <br>
>> <<a href="https://openjfx.io/openjfx-docs/#introduction" target="_blank">https://openjfx.io/openjfx-docs/#introduction</a>>, it might be worth
<br>
>> adding it.<br>
>><br>
>> On Thu, Oct 20, 2022 at 9:42 AM Thomas Reinhardt <br>
>> <<a href="mailto:thomas.reinhardt@s4p.de" target="_blank">thomas.reinhardt@s4p.de</a> <<a href="mailto:thomas.reinhardt@s4p.de" target="_blank">mailto:thomas.reinhardt@s4p.de</a>>> wrote:<br>
>><br>
>><br>
>> Hi!<br>
>><br>
>> Apologizes if this is not the proper list to ask my question.<br>
>><br>
>> For context: we are using the WebView of JavaFX in our legacy swing<br>
>> based frontend application. For now that is the only component we <br>
>> are<br>
>> using but we might migrate completely at a later point in time.<br>
>><br>
>> I have an issue with the way platform dependent dependencies are<br>
>> handled. We are using maven btw.<br>
>> My understanding is that during the build a profile is selected<br>
>> based on<br>
>> the host os name and architecture. That profile then sets a property<br>
>> (javafx.platform) that is in turn used as the classifier for <br>
>> platform<br>
>> dependent dependencies.<br>
>> (Offtopic to my question: eclipse warns that the profile ids are not<br>
>> unique in the org.openjfx:javafx pom.xml).<br>
>><br>
>> Which means that the result of my build is locked to a single <br>
>> platform.<br>
>> But we have customers for windows and linux and don't want to have<br>
>> separate artifacts as that would mean we also have to handle that<br>
>> distinction in our installer etc.<br>
>><br>
>> I know I can override the automatically detected platform but <br>
>> that does<br>
>> not solve the issue.<br>
>><br>
>> Ideally I would use something like -Djavafx.platform=all but that <br>
>> does<br>
>> not exist.<br>
>><br>
>> My question is: is there an existing solution where I can just <br>
>> include<br>
>> all platform dependencies for say windows and linux and the runtime<br>
>> "sorts it out"? A naive test (manual copying of artifacts) of mine<br>
>> unfortunately failed. Of course I could just use custom classloaders<br>
>> and<br>
>> do it myself but I really would prefer to use an existing <br>
>> solution and<br>
>> not implement some workaround.<br>
>><br>
>> If there is no solution (yet), is there interest in such a <br>
>> feature? We<br>
>> might be able to contribute to the project.<br>
>><br>
>><br>
>> -Thomas<br>
>></span></p>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div></blockquote></div>
</blockquote></div>