Consolidate your JavaFX app into a jar that runs on both Java 8/11

Conclusion

--Generate a fat jar that contains all the OpenJFX 11 libraries for each platform.

JavaFX (not included from Java 11)

JavaFX is a cross-platform GUI library that runs on the JVM. However, from Java 11, the library is no longer included, and instead it has been made into an external library as OpenJFX.

The problem here is "Which Java version do you support?" I want to support Java 11, but I can't easily truncate Java 8 (Free Oracle updates for individual users will continue until the end of 2020 java / eol-135779-ja.html)).

Fat jar that runs on both Java8 / 11

The solution to this problem is fat jar, which simply includes all the OpenJFX 11 libraries in the jar file.

Details can be found in Getting Started with JavaFX 11> Runtime images> Non-Modular project, but with Gradle (for normal jar task settings) In addition) add the following specifications.

build.gradle


compileOnly "org.openjfx:javafx-graphics:$javafx.version:win"
compileOnly "org.openjfx:javafx-graphics:$javafx.version:linux"
compileOnly "org.openjfx:javafx-graphics:$javafx.version:mac"

And if you build with JDK11, you will have a fat jar that works with both Java8 / 11.

Recommended Posts

Consolidate your JavaFX app into a jar that runs on both Java 8/11
Create a docker image that runs a simple Java app
Creating a lightweight Java environment that runs on Docker
Deploy a Java web app on Heroku
Build a streaming server on your iOS app
How to deploy a simple Java Servlet app on Heroku
[Beginner] android app that rolls a ball using a sensor [Java]
How to deploy a kotlin (java) app on AWS fargate
I created a Selenium sample app that supports multiple browsers (Chrome, IE, Firefox) that runs in Java.
How to deploy an app that references a local jar to heroku