Inflating FXML from subdirectory
<p>I have a Launcher class which I want to use to open a new window.</p>

<p>From main in Launcher, I'm calling :</p>

<p><code>ChatList chatList = new ChatList(communicator);</code></p>

<p>The constructor of ChatList calls method <code>showChatList()</code> where I try to inflate a FXML document:</p>

<pre><code>    private void showChatList() {
    try {
        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("fxml/ChatList.fxml"));
        Parent root = (Parent) fxmlLoader.load();
        Stage stage = new Stage();
        stage.setScene(new Scene(root));
        stage.show();
    } catch(Exception e) {
        e.printStackTrace();
    }
}
</code></pre>

<p>However I'm getting a <code>java.lang.IllegalStateException: Location is not set.</code> where I'm calling <code>fxmlLoader.load()</code>. My project file structure is as follows:</p>

<p><a href="https://i.stack.imgur.com/lL7Rs.png" rel="nofollow"><img src="https://i.stack.imgur.com/lL7Rs.png" alt="project structure"></a></p>

<p>I've tried putting in an absolute file path to the FXML file but still had no luck. </p>

<p>Can anyone help me understand what the general principle is behind inflating FXMLs in JavaFX (with multiple stages) or point me to a good resource that they've come across.</p>

<p>Cheers.</p>