Image does not appear after it generates .jar

0

How do I make my image appear in the application after generating .jar? I'm doing it this way and it's not working.

@FXML
private ImageView image;
@Override
public void initialize(URL url, ResourceBundle rb) {
    File file = new File("src/icons/logo-superplano.png");
     Image imagem = new Image(file.toURI().toString());
     image.setImage(imagem);
}
    
asked by anonymous 01.06.2015 / 16:03

2 answers

1

I solved the problem by placing the image in the same package as the main class. And then I used this code:

Image imagem = new Image(getClass().getResourceAsStream("logo-superplano.png"));
    
01.06.2015 / 18:22
0

Open jar with winrar and copy file or folder and just drag the file or folder to winrar

    
01.06.2015 / 16:18