1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Issue with JavaFX

Discussion in 'Developer Support' started by Ozzy, Dec 31, 2014.

  1. Ozzy

    Joined:
    Nov 5, 2014
    Messages:
    505
    Likes Received:
    162
    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:
    [​IMG]

    I have added the fxml as a resource in my mainfest:
    Code (Text):
    1. <resources>
    2.         <resource>scripts/MassFighter/GUI/FighterV1.fxml</resource>
    3.     </resources>
    Here's the contents of my Main class (the one which extends application):
    Code (Text):
    1. @Override
    2.     public void start(Stage primaryStage) throws Exception {
    3.         FXMLLoader loader = new FXMLLoader(getClass().getResource("FighterV1.fxml"));
    4.         Parent root = loader.load();
    5.         primaryStage.setTitle("MassFighter V4");
    6.         primaryStage.setScene(new Scene(root));
    7.         controller = loader.getController();
    8.         controller.initialize();
    9.         primaryStage.show();
    10.     }
    Which is then called in the onStart of my scripts bots main class like this:
    Code (Text):
    1. private void showAndWaitGUI() {
    2.         ui = new Main();
    3.         Platform.runLater(() -> {
    4.             try {
    5.                 ui.start(new Stage());
    6.             } catch (Exception e) {
    7.                 e.printStackTrace();
    8.             }
    9.         });
    10.         while (setupRunning) {
    11.             Execution.delay(100);
    12.         }
    13.         Platform.runLater(ui::close);
    14.     }
    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 (Text):
    1. FXMLLoader loader = new
    2. 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 (Text):
    1. FXMLLoader(MassFighter.getClass.getResource("FighterV1.fxml"))
    Any ideas? I really want to get my new UI out.
     
  2. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,938
    Likes Received:
    1,266
    Most likely has to do with obfuscation. @Cloud thoughts?
     
  3. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    It's not due to the obfuscation, his script bot 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.
     
  4. Ozzy

    Joined:
    Nov 5, 2014
    Messages:
    505
    Likes Received:
    162
    Thanks, I appreciate it. Would it be any help to you if I was to send you the version of MassFighter using JavaFX?
     
  5. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    Nah don't worry about it, if I need anything I'll ask.
     
  6. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,938
    Likes Received:
    1,266
    If it's in your SVN then we have read access to it. :)
     

Share This Page

Loading...