1

I have a java project in Eclipse and I have made the images I want as variables, and set the ImageViews to the images. When I run it, the images show as expected, but when I try to export the file the images don't show, but the ImageViews are still there (I know that because when I click on them they change a label). I have put the images into the project in a "ressources" source folder.

public class MainWindowController implements Initializable{

        private Main main;

            @FXML
            private TextField field;
            @FXML
            private Label bottomLabel;
            @FXML
            private ImageView rightImageView;
            @FXML
            private ImageView leftImageView;



        public void initialize(URL location, ResourceBundle ressources){
                Image encryptImage = new Image("file:src/encrypt.jpeg");
                Image decryptImage = new Image("file:src/decrypt.jpeg");
                rightImageView.setImage(encryptImage);
                leftImageView.setImage(decryptImage);
        }

When I export it, I select "Runnable JAR File" and "Package required libraries into JAR"

Thanks

Sebas1218
  • 11
  • 3
  • `"file:src/encrypt.jpeg"` (works only if and only if the working directory has a folder `src` that contains the file `encrypt.jpeg`) vs. https://stackoverflow.com/q/31127/6505250 – howlger Feb 25 '18 at 15:21

0 Answers0