为可执行 Jar 文件设置图标 [英] Set Icon for executable Jar file

查看:40
本文介绍了为可执行 Jar 文件设置图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的可执行 Jar 文件.我如何为这个文件设置图标?在我的例子中,我使用了我想更改的标准 Jar 图标.

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.

推荐答案

你可以使用setIconImage:

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

<小时>

更新

如果你想改变 coffee-cup 那么你可以使用像 JSmooth 这样的工具a> 创建可执行的 java 文件并更改 jar 文件图标.


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.

正如你在评论中看到的,JSmooth 可用于 windows 操作系统.对于 Mac,您可以查看此处的链接 关于如何更改图标.

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.

对于 linux 操作系统,您可以创建桌面 launcher 并为其选择图标图像.

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

这篇关于为可执行 Jar 文件设置图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆