3

I have a modular JavaFX 11 app, that I need to be able to bundle for Linux and Windows. I'm currently using jlink to do so and it works well. I need the bundle to be standalone, as the Java version on the target computers is 1.8 .

Now I must add the SMBJ library to my app. I grabbed the good old jar, and need to modularize it (otherwise I can't use jlink, as seen here).

Do I need to also modularize the bazillion deps SMBJ has, or is there another way?

Naman
  • 27,789
  • 26
  • 218
  • 353
Tim Autin
  • 6,043
  • 5
  • 46
  • 76
  • Relevant: https://stackoverflow.com/questions/47727869/creating-module-info-for-automatic-modules-with-jdeps-in-java-9 and https://stackoverflow.com/questions/47103221/is-there-a-way-to-add-maven-dependencies-while-using-the-maven-jlink-plugin (which both imply that the answer to your last sentence is yes, someone needs to create a module-info.java for each and every one of them). – VGR Feb 06 '20 at 18:59

1 Answers1

0

It is not true that jlink cannot be used to bundle non-modular applications. Have a look at this tutorial which shows you how to do it. https://github.com/dlemmermann/JPackageScriptFX It uses a combination of jlink and jpackage to achieve the desired result.

mipa
  • 10,369
  • 2
  • 16
  • 35
  • So, it requires Java 14, which is still in early access and has no official release. And while it builds *something* using non-modular jars, it’s not clear to me after a read-through whether this proves that `jlink` itself can take non-modular jars. – VGR Feb 06 '20 at 18:56
  • I did not claim that jlink itself can take non-modular jars. I said with a combination of jlink and jpackage you can achieve the desired result of bundling an application with a java run-time. The key point is that you can use your old non-modular jars for that. – mipa Feb 06 '20 at 19:47
  • And you need Java 14 only for the jpackage tool. You can still bundle your application with the current java 13 if you like. – mipa Feb 06 '20 at 19:48
  • Thanks to both of you for the answers. @mipa it seems I can't use your solution as the software will be ran on HiDPI monitors (see the last sentence)... Can't Maven / Gradle help here? Don't they already have a set of modularized dependencies? – Tim Autin Feb 07 '20 at 10:48
  • I don't know what you mean. I am using my apps on HiDPI (Mac Retina) screens all the time without problem and I also don't understand what that has to do with modularization. – mipa Feb 07 '20 at 11:46
  • Then it might be worth to give it a try. But at the end of the tutorial they say this solution doesn't work on HiDPI monitors. Maybe OSX is doing some magic here, I don't know. The app will have to run on Ubuntu and Windows. – Tim Autin Feb 07 '20 at 12:47
  • That comment only refers to the customization of installers but I have just deleted that comment because I helped to fix this issue in jpackage. (I am the co-author of the above tutorial) – mipa Feb 07 '20 at 15:01