JavaFX 11 is not part of the JDK any more, and it is distributed now in two flavors:
When you download the JavaFX SDK you have to choose a platform, the same as when you install the JDK for your platform. It remains cross-platform in terms of API, so your code will look the same on every platform, but it is platform-specific in terms of SDK/dependencies.
The reason for that is the native libraries that are bundled with each SDK.
If you have a look at the three JavaFX 11 SDK bundles each of them zipped has around 40 MB:
- Windows: 39.7 MB zipped, 64.8 MB in dll libraries (
jfxwebkit.dll
only has 59.2 MB), and 15.5 MB in jars and source.
- Mac: 39.7 MB zipped, 72.2 MB in dylib libraries (
libjfxwebkit.dylib
only has 67.8 MB), and 15.6 MB in jars and source.
- Linux: 43.8 MB zipped, 84.9 MB in so libraries (
libjfxwebkit.so
only has 80.1 MB), and 15.8 MB in jars and source.
Now the question is: would you bundle the three platforms in one? Total zipped size of 120 MB, unzipped native libraries for three platforms around 220 MB?
There was a debate about this issue precisely in the openjfx-dev mailing list, but I believe the taken approach is the correct one.
If you use Maven/Gradle and retrieve your dependencies from Maven Central, on Gradle you have to specify the classifier for your plaform. See the Getting Started sample. Maven does it internally, so even if you don't set the classifier, it only download the jars for your platform.
So for a regular project where you don't use WebView, it could make sense, as you will download only the required modules dependencies for your platform: javafx.base
, javafx.graphics
, javafx.controls
and javafx.fxml
.
But so far, and that's not something that can be changed now, you get your platform-agnostic JavaFX API but with platform-specific JavaFX SDK/modules.
Note that when you distribute a JavaFX application, you will use the Jpackager and you will release three different versions for the three different platforms, so either way you are in need of a platform-specific distribution.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…