在Linux可执行文件中嵌入图标

时间:2022-06-25 04:49:44

I have written an application in Java and succesfully compiled it using gcj.

我用Java编写了一个应用程序,并使用gcj成功编译了它。

In (X)ubuntu's File Manager, my application appears with the default Linux executable icon, which I would like to replace with my own.

在(X)ubuntu的文件管理器中,我的应用程序显示默认的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?

我已经看到其他应用程序显示自定义图标作为可执行文件,如Firefox,但不知道如何解决问题。 Linux二进制文件是否有某种资源编辑器?

Desktop Entry

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

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.

双击它会使终端弹出并再次消失,就是这样。我很确定应用程序无法启动,因为它无法找到所需的SWT库。我希望看到终端的输出,但我不能从那里启动它。

Furthermore, Ubuntu doesn't seem to acknowledge Icon. I have tried various resolution PNGs; no dice.

此外,Ubuntu似乎并不承认Icon。我尝试了各种分辨率的PNG;没有骰子。

2 个解决方案

#1


19  

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上的可执行文件没有嵌入图标(尝试将文件管理器指向/ usr / bin)。你看到的可能是桌面入口。这是一个描述图标,程序名称和可执行文件的文本文件。

#2


2  

On Ubuntu:

在Ubuntu上:

mouse right click the icon you don't like -> Properties -> in the opened window click the icon -> choose an icon you want

鼠标右键单击您不喜欢的图标 - >属性 - >在打开的窗口中单击图标 - >选择您想要的图标

#1


19  

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上的可执行文件没有嵌入图标(尝试将文件管理器指向/ usr / bin)。你看到的可能是桌面入口。这是一个描述图标,程序名称和可执行文件的文本文件。

#2


2  

On Ubuntu:

在Ubuntu上:

mouse right click the icon you don't like -> Properties -> in the opened window click the icon -> choose an icon you want

鼠标右键单击您不喜欢的图标 - >属性 - >在打开的窗口中单击图标 - >选择您想要的图标