Module not found: javafx.controls

I'm using gradle and below build.gralde works fine for me (org.beryx.jlink is optional to build standalone distribution).

plugins {
    id 'application'
    id 'org.openjfx.javafxplugin' version '0.0.5'
    id "org.beryx.jlink" version "2.3.0"  //optional for jlink
}

repositories {
    mavenCentral()
}

javafx {
    modules = [ 'javafx.controls' ]
}

mainClassName = 'gui.Main'

Make sure you don't have spaces in your list of modules:

--module-path PATH_TO_JAVAFX/lib --add-modules javafx.swing,javafx.graphics,javafx.fxml,javafx.media,javafx.controls

I had to also include the 'lib' directory: --module-path %PATH_TO_FX%;%PATH_TO_FX%\lib to make it compile.

Tags:

Java