Reputation: 171
I'm trying to change dock icon for jar file, but it works only with absolute path:
Image image = Toolkit.getDefaultToolkit().getImage("/User/Project/src/main/resources/icon.png");
even if files are in the same package this doesn't work:
Image image = Toolkit.getDefaultToolkit().getImage("./icon.png");
Upvotes: 1
Views: 583
Reputation: 1597
You should try this:
Toolkit.getDefaultToolkit().getImage("icon.png");
It will search the file name icon.png
inside main/resources
.
UPDATE:
If still not working, this should do the trick:
Toolkit.getDefaultToolkit().getImage("src/main/resources/icon.png");
Upvotes: 1