[Solved]How i can fix this Error? And i can do load .fxml files like normal JavaFX edit by SceneBuilder?

Error:
Uncaught exception thrown in Thread[main,5,main]
IllegalAccessError: superinterface check failed: class com.jayfella.jme.jfx.injme.JmeFxHostInterface (in unnamed module @0x30f621f7) cannot access class com.sun.javafx.embed.HostInterface (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.embed to unnamed module @0x30f621f7

Class Code:

import com.jayfella.jme.jfx.JavaFxUI;
import com.jme3.app.SimpleApplication;
import com.jme3.app.StatsAppState;
import javafx.scene.control.Button;
import javafx.fxml.FXMLLoader;


public class Main extends SimpleApplication {

    public static void main(String[] args) {
        
 
        
        Main main = new Main();
        main.start();
    }

     
        
     Main() {
        super(new StatsAppState());
    }
    @Override
    public void simpleInitApp() {
        try {
            JavaFxUI.initialize(this);
            Button btn_test = new Button("Click me");
            JavaFxUI.getInstance().attachChild(btn_test);
        } catch (Exception e) {
            System.err.println(e);
        }
        
        flyCam.setDragToRotate(true);
        
        
    }
        
}

Run the main class.

1 Like

now i still get a NullPointer Exception

I presume its the line where it says flyCam.setDragToRotate(true) because the default constructor is overridden to only add the StatsAppState. If you want the FlyCamAppState, add that to the constructor, too, or remove that line.

1 Like

thanks man for your help :slight_smile:

1 Like