How to change executable jar file icon?

后端 未结 5 861
感情败类
感情败类 2020-12-01 12:34

I have been able to change the runtime icon using this example like this

getFrame().setIconImage(Toolkit.getDefaultToolkit().getImage(getClass()
.getClassLoa         


        
相关标签:
5条回答
  • 2020-12-01 12:49

    A launch wrapper is the solution, I use launch4j, a cross platform lightweight wrapper

    launch4j website

    0 讨论(0)
  • 2020-12-01 13:02

    You may use JSmooth to create executable java file and also associate icon to it.

    0 讨论(0)
  • 2020-12-01 13:06

    No, there isn't, because icon is determined by Java. Only way to do so (at least for Windows) is to use wrapper like launch4j and then set icon path. If you already have wrapped exe with no or wrong icon, you can use Recource Hacker and then follow turtorials on how to change icon. Otherwise, you can't change .jar's icon

    0 讨论(0)
  • 2020-12-01 13:07

    As known, it is not possible to change .jar icon cause if you want to do it you should change all the .jar files in your operating system. Anyhow, a solution is possible. You can create a shortcut for the .jar and then you can change it: Right button >> Properties >> Change Icon.

    p.s. The icon file should be a .ico, so you can use many site for conversion in .ico extension if your image has got another one.

    Alternative 1: You can use also Launch4j, it's most simple way to generate application executable file.

    0 讨论(0)
  • 2020-12-01 13:13

    A possibility on mac is to use this line:

    com.apple.eawt.Application.getApplication().setDockIconImage( new ImageIcon(getClass().getResource( "resources/appIcon.png" )).getImage());
    

    It set your icon for the dock. I can't test it for now, i'm not working on a Mac but try it and get me up do date.

    0 讨论(0)
提交回复
热议问题