I try to change icon in my javaFX application. It starts but icon doesn't change in both application top left corner and in task bar. I use this code to change the icon:
Image icon = new Image(new File("window_icon.png").toURI().toString());
stage.getIcons().add(icon);
But it seems to have no effect at all (no exceptions as well). BTW: I'm sure the file exisits. I also tried different images and formats(.png, .ico and .jpg)
(I use ItelliJ 2021.3.2 on windows 10 and create scene with FXMLLoader)
What can be the problem?
Update: tried 16x16, 32x32, 64x64, image's original 256x256
using Image("file:window_icon.png")
doesn't change anything