I’m working on a javafx application so naturally I’ve had to use Scene Builder to display and manipulate fxml files. Everything seemed to be working fine until I decided to create a custom TableView and add it to the fxml file.
For the SDK, I’m using Zulu 17 packaged with javafx. For Scene Builder, I installed Scene Builder 21.0.0 which should be compatible with Java 17 according to the official website where they’ve stated that “You can use this Scene Builder version together with Java 17 and higher.“
Now, in Intellij IDE, I’ve made sure to manually point to the Scene Builder executable which I installed because I didn’t want the IDE to use any built-in Scene Builder (if there’s any):
Next, I created a custom class which directly extends TableView, I called it ReportTableView and I imported it into my fxml file:
<?import com.application.ui.component.table.ReportTableView?>
Then added it as a component:
<ReportTableView fx:id="reportTableView" prefHeight="385.0" prefWidth="791.0">
<VBox.margin>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</VBox.margin>
</ReportTableView>
So far, no compile errors are being shown and I’m actually able to add an instance field referencing this component to my controller class and run the application without any issues:
@FXML
private ReportTableView reportTableView;
The only issue I’m facing is when trying to switch to the Scene Builder tab of the fxml file editor. I’m getting the exception
java.lang.UnsupportedClassVersionError: com/application/ui/component/table/ReportTableView has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
Which is a bit weird. I know that the ReportTableView class is being compiled using Java 17, which can be confirmed by the exception message itself (class compiled with version 61.0), and I know that the Scene Builder executable is compatible with Java 17 and I explicitly pointed to it from the javafx settings as mentioned above, so I’m not sure why the exception is still referencing major version 55.0 (Java 8).
I also tried invalidating caches + restarting Intellij which didn’t make a difference.
What’s weirder is that Scene Builder has no problem displaying other built-in javafx components which are obviously also compiled with Java 17 since they’re part of the Zulu 17 SDK.
What could the issue be?