简体   繁体   中英

How to set ICON image for java.jar executable jar file

I have developed a game in Java made an executable jar file mygame.jar.

I now want to set an ICON image to mygame.jar so that it shows my custom image instead of usual java tea cup image.

Please don't confuse this with setting frame icon image with frame.setImageIcon("") method to set frame ICON image. I want my custom image to show up in mygame.jar desktop ICON

Unfortunately, the icon of a .jar file cannot be changed. The only way to set the icon is to convert it to a different form of executable. Such as .exe for windows, and .app for mac.

You can use tools such as JarBundler or Appbundler for converting to app , and there are a few tools for converting to .exe .

You can use a wrapper like JSmooth for jars. Not only does it allow you to define custom icons for your java applications, it also creates .exe for your java applications.

JSmooth DOC and a good tutorial

Is not possible. Not in the jar itself. You have to generate a wrapper that executes the jar, and this script will have the icon. You can try JSmooth.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM