Welcome!

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

Sign up now!

Question unknown path error to fxml file + npe error to img file when trying to test EmbeddableUI

Joined
May 15, 2018
Messages
6
Trying to get EmbeddableUI to work, it's having trouble issues finding my resources.

Here's the error message:

Code:
javafx.fxml.LoadException:
unknown path

   at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2579)
   at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2425)
   at com.hexdump.bots.bot.ExampleBot.botInterfaceProperty(ExampleBot.java:44)
   at java.util.concurrent.FutureTask.run(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
   at com.hexdump.bots.bot.ExampleBot.initialize(ExampleBot.java:56)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
   ... 6 more

Here's my main class:

Code:
public class ExampleBot extends TreeBot implements EmbeddableUI, Initializable {
    private ObjectProperty<Node> botInterface;
    private ImageView img;

    public ExampleBot() {
        setEmbeddableUI(this);
    }

    @Override
    public void onStart(String... arguments) {
        setLoopDelay(400, 950);
    }

    @Override
    public TreeTask createRootTask() {
        return new RootBranch();
    }

    @Override
    public ObjectProperty<? extends Node> botInterfaceProperty() {
        if (botInterface == null) {
            FXMLLoader loader = new FXMLLoader();
            loader.setController(this);
            try {
                Node node = loader.load(Resources.getAsStream("com/hexdump/bots/bot/ExampleXFML.fxml"));
                botInterface = new SimpleObjectProperty<>(node);
            } catch (IOException e) {
                e.printStackTrace();
            }

        }
        return botInterface;
    }

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        img.setImage(new Image(Resources.getAsStream("com/hexdump/bots/bot/img.jpg")));
    }
}

And here's a picture of my file tree:

j6bHyoa.png
 
Top