I have just began building a JavaFX application in IntelliJ using the latest Java7 SDK.
I have built my interface using Oracle Scene Builder, everything runs and dis
I get this error when opening the Scene Builder.
Installed jdk1.8, set it as my system's default (in /usr/lib/jvm/default-java) and modified my $PATH, none of which seemed to help.
Then updated the Scene Builder from 1.1 to 2.0, linked the 1.1 binary to the 2.0 version (see this question) and finally set the new Scene Builder path in Netbeans -> tools -> options -> Java -> JavaFX, which resolved the issue. Updating the default jdk version may or may not have had something to do with it.
The project itself used jdk1.8 already and I had no trouble running it; I only had issues opening them in the Scene Builder (got that error mentioned in the question title).
I've got the same error when I was trying to set my own CSS properties in my program. If you are not doing this, you are probably using some class that uses the CSS library introduced in JavaFX 8.
Try to update your JDK to the latest released version here.
If this still does not work, then somewhere in your application a CSS file is not being read correctly. There is probably some class with JavaFX bean properties that were wrongly mapped.
You were creating an FXML in Scene Builder 2 and running in JDK 7. SB 2 "tries to" create Java 8 compatible FXML code. To fix the FXML:
stylesheets="@MainView.css"
attribute<?import java.net.*?>
in the importsAdd the below code at the end of parent pane, after </children>
(in my case it was before </AnchorPane>
):
<stylesheets>
<URL value="@MainView.css" />
</stylesheets>
It turns out I needed to manually link the stylesheet in my start() method as JavaFX7 does not support the stylesheets tag.
To fix this I called the following command in my Start() method
root.getStylesheets().add(this.getClass().getResource("view/MainView.css").toExternalForm());
Where root
is the name of my FXMLLoader.