IntelliJ IDEA fails to open SceneBuilder in all Java versions

Viewed 562

Whenever I try to open the SceneBuilder tab in my fxml file I get an error saying that it failed to open the file in the Scene Builder as well as the exception below:

java.lang.ClassNotFoundException: javafx.scene.Node

java.lang.NoClassDefFoundError: javafx/scene/Node

The problem is that I can do import javafx.scene.Node in my Main.java file without any errors.

I tried to use Java 8, 11, and 13 with both Scene Builders for Java 11, and 8 in all possible combinations, but I get the same error all the time.

I use IntelliJ IDEA 2019.3 on Windows 10, Azul Zulu as my JDK and JavaFX SDK library.

Is there any fix available for that?

1 Answers

Are you on Linux? if it's the case, I had a same issue using JDK8 and a solved it by changing the Java version in my terminal, I found out I was using JDK8 in IntelliJ but the the output of java -version was OpenJDK (which don't include the FX library).

So, assuming you have the same issue as me, here is how you can solve it :

  1. First check your java version :
   java -version
  1. change the default java version by typing :
    sudo update-alternatives --config java

then choose JDK8 or OpenJFX (JDKs newer than 11 won't work since they removed the FX from it)

  1. Restart your IDE and it should open SceneBuilder inside the editor.
Related