eclipsegradlejavafxjava-modulebuildship

How to run a JavaFX app in Eclipse with Gradle dependencies?


If I try to run a JavaFX app with a classic classpath inside Eclipse then I get follow warning:

WARNUNG: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @7b58231a'

That I try to run it with named modules. Then I get the follow error:

java.lang.module.FindException: Module javafx.controls not found, required by JavaFxSample

The module-info look like:

module JavaFxSample {
    requires javafx.graphics;
    requires javafx.controls;
    requires javafx.web;
}

The build.gardle look:

plugins {
  id 'application'
  id 'org.openjfx.javafxplugin' version '0.1.0'
}

repositories {
    mavenCentral()
}

sourceCompatibility = 17

javafx {
    version = '' + sourceCompatibility + '.+'
    modules = [ 'javafx.controls', 'javafx.web' ]
}

It look like that Gradle has detect that it is a module:

Java Build Path

If I add the follow to the Gradle script it has no effect:

java {
    modularity.inferModulePath = true
}

I am use:

How can I force that that the modules from Gradle dependencies are added to the launcher modulpath inside Eclipse? Is this a JavaFX problem or an Eclipse/Gradle problem?


Solution

  • You need enable the module support for Gradle in Eclipse.

    Window > Preferences: Gradle > Experimental features: Enable module support