0
How do I get my image to appear in the application after the . jar generation? 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);
}
Take a look at this question. http://answall.com/questions/15574/addir-imagem-ao-jar/15719#15719
– adelmo00
The image is already inside a package. And when I use
Image image2 = new Image(frmLoginController.class.getResourceAsStream("/src/icons/logo-superplano.png"));
of error.– DiegoAugusto
Put the mistake there.
– adelmo00
Exception in Application start method
java.lang.reflect.InvocationTargetException
– DiegoAugusto
When you try the way you are in the question, the same error occurs?
– adelmo00
No, the image appears when I compile and run the program. However when the . jar image does not appear
– DiegoAugusto