Closed tarheel closed 5 years ago
I've succeeded in getting the app to build and run in JDK 11 within IntelliJ, but I haven't yet figured out how to generate a functional JAR. There doesn't appear to be any simple way to do this. :(
Upon further investigation: it looks like it's impossible to build a single cross-platform JAR for a JavaFX app in Java 11+, because you have to include native libraries in the build. So if we're going to move to 11 or higher, we'll have to start doing separate builds for Mac, Windows, and Linux. It also doesn't appear to be possible to accomplish this directly in IntelliJ.
Alternatively, we can just ask people to install JavaFX for themselves. I'm able to make the JAR work under Java 11 with this command:
java --module-path lib/javafx-sdk-11.0.2/lib --add-modules=javafx.controls,javafx.fxml -jar out/artifacts/rcv_jar/rcv.jar
Some possibly helpful links if we want to do something fancier: https://medium.com/@adam_carroll/java-packager-with-jdk11-31b3d620f4a8 https://medium.com/azulsystems/using-jlink-to-build-java-runtimes-for-non-modular-applications-9568c5e70ef4
Just making sure I have this right: you can make a standalone build for MacOS jdk 11 other platforms will require a platform-specific build process alternatively the end user can install JavaFX for their platform, and our current .jar should work
I have not succeeded in making a standalone build, even for Mac. My understanding is that it is possible to do it for any platform using the corresponding JavaFX jmods, but I haven't figured out that process yet.
I did confirm that our current JAR works under JRE 11 if you download the JavaFX SDK and reference it in the command line args, as described above... at least on my Mac. Presumably it would also work on other platforms, but I don't have a convenient way to test.
The answer here may be to start officially using Maven or Gradle (this comment made me realize that).
Sure, go for it. And I agree that this is not the top priority at the moment.
This is a great idea :) Using Gradle is also going to be helpful when we are ramping up our build and release process which is a big chunk of the VVSG requirements.
Another note somewhat related to this: we should make sure we're developing with Open JDK 11+, rather than shitty Oracle JDK 11+.
Explored this issue today and was able to get a basic "hello world" JavaFX Gradle project going in IntelliJ, mostly following these "JavaFX and IntelliJ => Modular with Gradle" instructions (with some bouncing over to the non-modular version on the same page when I hit walls). I used OpenJDK 12, downloaded from here.
Here are some notes on how our development workflow would change after migrating over to Gradle:
Build: Tasks => build => build
Run: Tasks => application => run
Unit tests: Tasks => verification => test
Distribute: zip (standard, but probably requires more work by user): Tasks => distribution => distZip These two options require the "Badass JLink Plugin". Here's a great StackOverflow answer that outlines most of this stuff. jlink image (using the targetPlatform parameter, we can create images for Linux, Windows, etc. that don't even require the user to have the JRE installed!): Tasks => build => jlink or jlinkZip ** jpackage installer (needs configuration, and may require JDK 13, but theoretically produces native .msi, .dmg, .deb files for different platforms): Tasks => build => jpackage
The next step is for me to get all our existing code moved over to this new format / structure.
I labeled this cert-del because it sounds related to the Java issue you guys have spent so much time on recently. If I am wrong, feel free to correct me.
Addressed via #272. Now the tabulator only works in JDK 11+. When distributed using Gradle's distZip
task, it requires that the user have the JDK installed. When distributed using Gradle's jlink
task, it doesn't even require that the user have the JDK installed (the zip is 48 MB vs. 26 MB with distZip
).
From Greg Dennis:
Hi guys,
The suggestion on rankedchoicevoting.org to use JDK 11 doesn't seem to work:
I think this is because JavaFX is available as a separate module in JDK 11. I had to jump through Oracle's hoops to download their archived JDK 10 version to run it successfully.
There is some guidance on StackOverflow on building a JavaFX app that runs on JDK 11 (and presumably continues to work with JDK 10, too). Have you looked into doing that? If that would take a longer-term effort, maybe the website instructions should be updated in the interim?
Thanks, Greg