so the problem is as follows:
I created an FXML file and edited it with JAVA SCENE BUILDER.
on the scene builder i added an image view and set the path to the file
the code in the fxml file is:
<ImageView fitHeight="285.0" fitWidth="301.0" layoutX="94.0" layoutY="94.0" opacity="0.26" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../../src/view/images/mainpic.png" />
</image>
</ImageView>
now i have a main class that loads that FXML file. and the image is in the src file.
pic related:
when i run the main from eclipse the picture is loaded correctly. but when i create a jar file the image is not loaded.
question is: how do i get the jar file to get the images specified in the fxml file?
also code of main:
URL url = getClass().getResource("/view/mainMenuView.fxml");
AnchorPane pane = FXMLLoader.load( url );
StackPane p = new StackPane();
p.getChildren().add(pane);
StackPane.setAlignment(pane,Pos.CENTER);
Scene scene = new Scene( p);
// setting the stage
primaryStage.setScene( scene );
primaryStage.show();
thanks for fabian to answer the question right. realizing the same thing as fabian the answer is that
is the right path to the picture.