I'm having problem loading my code to my fxml file even tho they have the same filename.The code won't automatically add to my fxml file when I put those 3 buttons.(See Figure.1). I didn't open the scenebuilder inside of my intellij becase of having that error(See figure.2) thus, I right clicked 'SceneBuilderProject.fxml' and clicked 'Open in SceneBuilder'. Any suggestion to verify the path from scenebuilder to the javafx i'm working with?
java.lang.ClassNotFoundException: com.sun.javafx.fxml.LoadListener PluginClassLoader[org.jetbrains.plugins.javaFX, 192.5728.98] com.intellij.ide.plugins.cl.PluginClassLoader@3104190
java.lang.NoClassDefFoundError: com/sun/javafx/fxml/LoadListener
com.intellij.diagnostic.PluginException: While loading class com.oracle.javafx.scenebuilder.kit.fxom.FXOMLoader: com/sun/javafx/fxml/LoadListener [Plugin: org.jetbrains.plugins.javaFX
Above is the actual error from figure.2
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("SceneBuilderProject.fxml"));
primaryStage.setTitle("SceneBuildProject");
primaryStage.setScene(new Scene(root, 300, 275));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Above is the Main Class.
Use:
FXMLLoader.load(getClass().getResource("src/SceneBuildPackage/SceneBuilderProject.fxml"));
instead of:
FXMLLoader.load(getClass().getResource("SceneBuilderProject.fxml"));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.