IntelliJ IDEA 2019.3 Help

Package JavaFX applications

You can package your JavaFX application by building the corresponding artifact (a Java archive). For JavaFX applications, IntelliJ IDEA provides a dedicated artifact type: JavaFx Application.

Build JavaFX artifacts

Create a new artifact configuration

IntelliJ IDEA creates the artifact for packaging the application together with the project. However, you can create a new artifact configuration with your custom settings.

  1. From the main menu, select File | Project Structure Ctrl+Shift+Alt+S and click Artifacts.

  2. Click the Add button, point to JavaFx Application, and select From module '...'.

    Creating a new artifact configuration

    IntelliJ IDEA creates the artifact configuration and shows its settings in the right-hand part of the Project Structure dialog.

  3. Name the new configuration.

  4. Switch to the Java FX tab and in the Application class field, specify the main() method.

  5. Apply the changes and close the dialog.

    Creating a new artifact configuration: specifying the main class

Build the artifact

  1. From the main menu, select Build | Build Artifacts.

  2. In the popup that opens, select the necessary artifact and select Build.

By default, the artifact is generated to <project_folder>\out\artifacts\<artifact_name>.

Troubleshoot

  • Error:Java FX Packager: Can't build artifact – fx:deploy is not available in this JDK

    This is a known issue: IDEA-200721. Currently, you can package a JavaFX application in a .jar only with Java 8.

Last modified: 20 March 2020