4

I'm building a program for university. Because it uses JavaFX I'm managing dependencies via Maven. I'm on a Windows machine and generate a runtime image using the goal clean javafx:jlink. This generates a folder with some .dll files, java.exe and javaw.exe and the launcher.bat. There is also a launcher script for shells. When I run the executable on my MacBook it doesn't run because, naturally, it doesn't find the needed java Runtime that should be included in the bin folder like the java.exe for Windows.

So my question is: can I make Maven include a MacOS and possibly even a Linux Java Runtime while building on my Windows machine? So that in the resulting bin folder there are the JavaFX versions for Windows, MacOS and Linux and a java executable for Windows, MacOS and Linux?

  • You might find [this](https://stackoverflow.com/questions/53453212/how-to-deploy-a-javafx-11-desktop-application-with-a-jre) helpful. I don’t know to apply it to Maven; hopefully the Maven goal has properties for defining both the JDK and JavaFX library locations at build time. – VGR Apr 01 '20 at 13:40
  • The standard Java tools can only build for the same platform as they currently run under. You will need to build on each platform. – Thorbjørn Ravn Andersen Apr 01 '20 at 15:18
  • Thank. I thought that building for multiple platforms would be such a common task that there would be built-in tools. That explains why I couldn't find anything on how to do it. – Nova Shadowflame Apr 01 '20 at 15:27
  • Plenty of solutions for plain Java distributions (jar files etc). Proper MacOS bundling (to my knowledge) require native tools provided by the operating system, making it very hard to do cross-platform. – Thorbjørn Ravn Andersen Apr 01 '20 at 16:30

0 Answers0