Module not found: javafx.controls

We Are Going To Discuss About Module not found: javafx.controls. So lets Start this Java Article.

Module not found: javafx.controls

  1. Module not found: javafx.controls

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

  2. Module not found: javafx.controls

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

Solution 1

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

Original Author Arilou Of This Content

Solution 2

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'

Original Author Leon Of This Content

Solution 3

The problem was solved in 3 steps.

  1. Use %PATH_TO_FX% instead of $PATH_TO_FX in the command line.

  2. Recreate the variables (both system and user) PATH_TO_FX enclosing its value in quotation marks. As the directory “C:\Program Files\Java\javafx-sdk-11.0.1\” contains a space, it caused an error “invalid flag”.

  3. Rebooting the computer to update the variables.

Original Author Leon Of This Content

Solution 4

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

Original Author Nikolay Frick Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment