Hi Mark, Is using jlink (https://docs.oracle.com/javase/9/tools/jlink.htm) packaging your app with the exact set of modules you need an option for you? That would eliminate the need for your users to have Java installed. Not only there is a (small) hurdle to install Java, but it needs to be the "correct" version of Java as well, and you would probably expect your users to update their JDK with security updates etc.
I've been a long-time fan of the javapackager, and now that jlink allows you to create a custom runtime image, I think we have much better solutions than relying on the fact that an end-user installed an ok version of the JDK? But maybe I'm missing something, and is jlink not an option for you? - Johan On Fri, Feb 9, 2018 at 2:40 PM Mark Raynsford <org.open...@io7m.com> wrote: > Hello! > > I've been using Swing for many years. One of the things I like most > about it is that it's essentially guaranteed to be present in any Java > SE installation, and although it's a little outdated aesthetically, it > works well and continues to work well. > > I've been exploring the possibility of migrating to JavaFX on and off, > but the biggest showstopper for me is that JavaFX may not actually be > present in any given user's installation. If someone installs the > jre9-openjdk package on Arch Linux, for example, they don't get JavaFX. > If they install the java-openjfx package, they do (although Arch only > offers JavaFX 8 right now). > > I'm migrating to Java 9 modules, and all new projects will be fully > modular projects. In the olden days (pre Java 9), it was possible to > detect if JavaFX was present with a reflection hack: > > try { > Class jfxPanel = classLoader.loadClass("javafx.embed.swing.JFXPanel"); > isJavaFxAvailable = true; > } catch (ClassNotFoundException e) { > isJavaFxAvailable = false; > } > > The idea being that you could at least display a friendly error message > to the user explaining that they need to install JavaFX if they're > using OpenJDK. > > But obviously in a Java 9 project, that's not going to work: You'd need > to specify a "requires" clause on the JavaFX modules, and if they > weren't present, the VM wouldn't even start up so the above check > wouldn't get a chance to run. > > For applications, I could probably try to bundle JavaFX with them > (although there may be licensing issues there). For libraries, I'm out > of luck. The only apparent option there is for me to pick a set of > Maven coordinates like "org.openjdk:javafx:8.0" and specify those in my > libary's POM file (and assume that the user is smart enough to deploy > JavaFX to a local repos to use it). > > I suppose what I'm really saying is: When (if ever) can I expect JavaFX > to be present unconditionally with OpenJDK installs? I probably can't > migrate to JavaFX until that day... > > -- > Mark Raynsford | http://www.io7m.com > >