在Linux可执行文件中嵌入图标 [英] Embedding an icon in a Linux executable
问题描述
我用Java编写了一个应用程序,并使用 gcj 成功编译了它。
I have written an application in Java and succesfully compiled it using gcj.
在(X)ubuntu的文件管理器中,我的应用程序显示默认的Linux可执行图标,我想用自己的图标替换。
In (X)ubuntu's File Manager, my application appears with the default Linux executable icon, which I would like to replace with my own.
我看到其他应用程序显示自定义图标作为可执行文件,例如Firefox,但不知道如何解决问题。 Linux二进制文件是否有某种资源编辑器?
I have seen that other applications display a custom icon as the executable, such as Firefox, but have no idea how to approach the problem. Is there some sort of resource editor for Linux binaries?
我试过创建一个桌面执行应用程序的条目文件如下:
I've tried creating a Desktop Entry file that executes the application as follows:
[Desktop Entry]
Version=1.0
Type=Application
Name=MyJavaApp
Comment=
Exec=./MyJavaApp
Path=./../../libs/
Terminal=true
Icon=./icon.png
X-KDE-Library=./../../libs/libswt.so
双击它会使终端弹出并再次消失,就是这样。我很确定应用程序无法启动,因为它无法找到所需的SWT库。我希望在终端中看到输出,但我无法从那里启动它。
Double-clicking it makes a terminal pop up and disappear again, and that's it. I'm fairly sure the application doesn't launch because it can't find the required SWT library. I was hoping to see the output in the terminal, but I can't launch it from there.
此外,Ubuntu似乎不承认图标
。我尝试了各种分辨率的PNG;没有骰子。
Furthermore, Ubuntu doesn't seem to acknowledge Icon
. I have tried various resolution PNGs; no dice.
推荐答案
Linux上的可执行文件没有嵌入图标(尝试将文件管理器指向的/ usr / bin中
)。您所看到的可能是桌面条目。这是一个描述图标,程序名和可执行文件的文本文件。
Executables on Linux do not have icons embedded (try to point your file manager to /usr/bin
). What you have seen is probably a Desktop Entry. That's a text file describing the icon, program name and the executable.
这篇关于在Linux可执行文件中嵌入图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!