IntelliJ IDEA 2023.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. In the main menu, go to File | Project Structure Ctrl+Alt+Shift+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 JavaFX 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. In the main menu, go to 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

    The fx:deploy task was a part of the Ant plugin that was formerly distributed in ant-javafx.jar as a part of Java Packager. The Ant plugin is not included in jpackage in the current JDK versions.

    If you're using a JDK build of version 9 and later, use third-party solutions for packaging. For example, refer to section Runtime images in the JavaFX official documentation. You can find more options for packaging on Stackoverflow.

    Alternatively, you can use a JDK with JavaFX included, for example, the Bellsoft Liberica JDK 11.

Last modified: 11 February 2024