Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Issue with JavaFX

Joined
Nov 5, 2014
Messages
505
My JavaFX GUI loads and functions correctly on my local version, but when live on the bot store it fails to display.

Here's my project structure:
R2mXsZS.png


I have added the fxml as a resource in my mainfest:
Code:
<resources>
        <resource>scripts/MassFighter/GUI/FighterV1.fxml</resource>
    </resources>

Here's the contents of my Main class (the one which extends application):
Code:
@Override
    public void start(Stage primaryStage) throws Exception {
        FXMLLoader loader = new FXMLLoader(getClass().getResource("FighterV1.fxml"));
        Parent root = loader.load();
        primaryStage.setTitle("MassFighter V4");
        primaryStage.setScene(new Scene(root));
        controller = loader.getController();
        controller.initialize();
        primaryStage.show();
    }

Which is then called in the onStart of my scripts main class like this:
Code:
private void showAndWaitGUI() {
        ui = new Main();
        Platform.runLater(() -> {
            try {
                ui.start(new Stage());
            } catch (Exception e) {
                e.printStackTrace();
            }
        });
        while (setupRunning) {
            Execution.delay(100);
        }
        Platform.runLater(ui::close);
    }

However I think the problem is related to the following line as after some debugging it seems to be failing to find the resource, but this only happens on the bot store, it runs fine locally:

Code:
FXMLLoader loader = new
FXMLLoader(getClass().getResource("FighterV1.fxml"));

I've tried changing the base class and relocating the fxml file as necessary but it didn't solve the problem, both of these approaches work fine locally:

Code:
FXMLLoader(MassFighter.getClass.getResource("FighterV1.fxml"))

Any ideas? I really want to get my new UI out.
 
Engineer
Joined
Jul 28, 2013
Messages
2,776
Most likely has to do with obfuscation. @Cloud thoughts?
It's not due to the obfuscation, his script is unable to locate the resource file after it's packed into the jar. The difference in local vs botstore is that it's packed in a jar and not a free standing file. As for the solution to his problem, I'm looking into it although I can verify it is on there end.
 
Joined
Nov 5, 2014
Messages
505
It's not due to the obfuscation, his script is unable to locate the resource file after it's packed into the jar. The difference in local vs botstore is that it's packed in a jar and not a free standing file. As for the solution to his problem, I'm looking into it although I can verify it is on there end.

Thanks, I appreciate it. Would it be any help to you if I was to send you the version of MassFighter using JavaFX?
 
Top