title: JAVAFX: Location is not set error
body: <p>My project is running properly in eclipse but when I am creating a jar file of this project and trying to run it through cmd it is showing "Location is not set" error.</p>
  
  <p>My project structure is:</p>
  
  <p><a href="https://i.stack.imgur.com/OsYsM.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/OsYsM.jpg" alt="This is the structure of my project"></a></p>
  
  <p>The Method is (Running in eclipse):</p>
  
  <pre><code>@FXML
  private void RegularCustomer(ActionEvent event) throws Exception{
      Stage stage = (Stage) dailySales.getScene().getWindow();
      Scene scene = dailySales.getScene();
      FXMLLoader loader = new FXMLLoader(getClass().getResource("../customer/CustomerHome.fxml"));
      System.out.println(loader.getLocation());
      scene.setRoot(loader.load());
      stage.setScene(scene);
      stage.show();
  }
  </code></pre>
  
  <p>What is wrong with this code?</p>
  
  <p>There are some relative questions but they are different from it. Their code didn't run in IDE but my code run in IDE.</p>
  
  <p>FYI: I made some changes in folder structure and was able to run successfully. But that structure was horrible because I put all my FXML files and controllers in same package.</p>