Search code examples
javajavafxfxml

load FxML File without JavaFX


So I tried to download JavaFx from the official Website but I didn't find any downloads for Mac (catalina). Before I downloaded SceneBuilder and JavaFX in the eclipse marketplace both are working fine. Than I made a GUI in SB. Can I import this Fxml file in a Projekt and use it, or do I need the full working version of JavaFx?

Maybe someone knows where I can even download JavaFX that would make a lot easier. Thanks in advance!


Solution

  • Your app will need access to the OpenJFX libraries that implement JavaFX. You need access at compile time and at runtime.

    Either bundle the libraries with your app, or make them available with your JDK.

    To bundle, either manually download and install into your app, or let a dependency manager tool do that. I recommend the tool approach. Use either Apache Maven or Apache Gradle.

    To make available with your JDK, either manually download and install somewhere on the machine’s class path (canonical location varies by platform), or use a JDK that comes bundled with the libraries. At least two vendors provide the latter as editions of their JDK offering: ZuluFX by Azul Systems, and LibericaFx by BellSoft.

    After making the OpenJFX libraries available to your app by any of these four approaches, you can programmatically refer to your FXML files. See tutorial at the OpenJFX website.

    Tip: While I do not use Eclipse, I do know that the IntelliJ IDE provides a template for easily creating a new JavaFX app. The new project includes a working FXML file to show you how to get started.