8

I upgraded from Java 10 to Java 12 and JavaFX 12.

Now I can't compile my project anymore because javafx.embed.swingSwingFXUtils is no longer recognized.

Intellij can't find any library for the class. Seems like javafx.embed doesn't exist anymore.

I looked to see if the package was dropped but I couldn't find any information regarding it.

Naman
  • 27,789
  • 26
  • 218
  • 353
Guillaume F.
  • 1,010
  • 7
  • 21

3 Answers3

12

The module javafx.swing needs to be included in the gradle file:

javafx {
    modules = [ 'javafx.controls', 'javafx.graphics', 'javafx.swing', 'javafx.base' ]
}
Guillaume F.
  • 1,010
  • 7
  • 21
3

In my case, a file called module-info.java was generated in the same package. There I had to add

requires javafx.swing;

When building again, the class was found.

david-1160
  • 62
  • 1
  • 5
2

In my case, it worked after I included javafx.swing dependency in pom.xml

        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-swing</artifactId>
            <version>19</version>
        </dependency>

check the version here https://mvnrepository.com/artifact/org.openjfx/javafx-swing

Kunal Tyagi
  • 2,341
  • 1
  • 15
  • 26