Set Icon for executable Jar file [duplicate]

女生的网名这么多〃 提交于 2019-11-27 02:13:19

问题


This question already has an answer here:

  • How to change executable jar file icon? 5 answers

I have a simple executable Jar file. How I can set icon for this file? In my case I use the standard Jar icon which I would like to change.


回答1:


you can use setIconImage:

frame.setIconImage(
new ImageIcon(getClass().getClassLoader().getResource("PATH/TO/YourImage.png"))
);

Update

If you want to change the coffee-cup then you may use tools like JSmooth to create executable java file and also change the jar file icon.

As you can see in the comments JSmooth can be used for windows operating systems. For Mac you can check the link here on how to change the icon.

For linux OS you can create a desktop launcher and choose an icon image for it.




回答2:


One of my friends suggested me about JSmooth which can be used to associate icon to a jar file.

You can try this.

Edit:

But this will work only for Windows OS.

PS : This tool can be used to convert jar to exe and then you can set icon to it.



来源:https://stackoverflow.com/questions/19927509/set-icon-for-executable-jar-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!