Eclipse Icon not shown, desktop file points to xpm

12,234

Solution 1

I am pretty sure you have another eclipse.desktop file in ~/.local/share/applications. The one you show in the image looks fine. Most likely, you ran Eclipse a single time before moving it to /opt. Then a .desktop file is automatically created in ~/.local/share/applications.

.desktop files in ~/.local/share/applications overrule global ones in /usr/share/applications, which means that whatever you change to the global one, it has no effect whatsoever; the one in ~/.local/share/applications takes precedence ans is the one that shows in the Launcher.

If so, remove the one in ~/.local/share/applications, log out and back in.


EDIT


After your latest comment, it becomes clear what happened: It turns out you previously made a local launcher with alacarte. Alacarte does not handle icon paths correctly when using absolute paths; alacarte simply leaves out the icon's extension, but extensions are needed when using absolute paths.

See also here.

Solution 2

I had the same issue which wasn't solved by any of the above but by not enclosing the path to the icon file in quotes (there were no spaces in the path or file name). Icon was then displayed as expected. The exec line handled quotes fine though.

ie changed

Icon="/path/to/file/icon.xpm"

to

Icon=/path/to/file/icon.xpm
Share:
12,234

Related videos on Youtube

SPMP
Author by

SPMP

Updated on September 18, 2022

Comments

  • SPMP
    SPMP over 1 year

    I recently installed the latest version of Eclipse that I downloaded from the Eclipse website. It is located at /opt/eclipse. I have a symbolic link form /usr/bin/eclipse to /opt/eclipse/eclipse. I also have a file named eclipse.desktop in /usr/share/applications, whose contents are as follows:

    [Desktop Entry]
    Name=Eclipse
    Comment=Eclipse C++ IDE
    Exec=/opt/eclipse/eclipse
    Icon=/opt/eclipse/icon.xpm
    Terminal=false
    Type=Application
    Categories=Development;
    StartupWMClass=Eclipse
    

    /opt/eclipse/icon.xpm exists. However, the icon is not shown in the dock or in the list of applications. Any ideas? I'm on Ubuntu 14.04.

    EDIT: Tried updating StartupWMClass, doesn't help. Here's a screenshot that captures the situation:

    [enter image description here]

    • Jacob Vlijm
      Jacob Vlijm about 8 years
      This usually happens if one of the fields is invalid. What happens if you change the Exec= line into /opt/eclipse/eclipse? (or if you run from a terminal: eclipse, or /usr/bin/eclipse)
    • SPMP
      SPMP about 8 years
      Changing to /opt/eclipse/eclipse doesn't fix it. I have never had a problem running eclipse with this link. The only issue is that the icon doesn't show up.
    • Jacob Vlijm
      Jacob Vlijm about 8 years
      Ah, do you mean a launcher without an icon, or no launcher at all?
    • SPMP
      SPMP about 8 years
      The launcher has an icon of a sheet of paper. When eclipse is running, a question mark appears on the dock.
    • SPMP
      SPMP about 8 years
      When I use the Alt+Tab task switcher, icons for all other tasks show up fine, but there is nothing showing for eclipse.
    • Jacob Vlijm
      Jacob Vlijm about 8 years
      See my updated answer. I understood the generic icon appeared while running Eclipse, but you image shows it has no icon at all.
  • SPMP
    SPMP about 8 years
    Thanks for the answer. Doesn't help though. I've updated the question with a screenshot.
  • Jacob Vlijm
    Jacob Vlijm about 8 years
    @user2308211 See my updated answer. I understood the generic icon appeared while running Eclipse, but your image shows it has no icon at all.
  • SPMP
    SPMP about 8 years
    Thanks!! Here's what was happening: There were no eclipse.desktop files, but there were quite a few alacarte-made**.desktop files from my previous attempts using the GUI launcher creator. Deleted all of those, and the icon shows up fine.
  • Jacob Vlijm
    Jacob Vlijm about 8 years
    @user2308211 perfect! One of them must have been the one in the launcher :)
  • SPMP
    SPMP about 8 years
    One other concern though. I'm using the compiz application switcher, so that I can see each window (for example different Google Chrome windows) as a separate entity in Alt+Tab. Usually, the icons show up when I do Alt+Tab, but that one is still empty for Eclipse. Any ideas?
  • Jacob Vlijm
    Jacob Vlijm about 8 years
    @user2308211 did you already log out/in or restart?
  • SPMP
    SPMP about 8 years
    Yeah. That's when the original problem was fixed.
  • SPMP
    SPMP about 8 years
    I'm pretty sure the correct desktop file is used. Because I tried changing icons, and they change correctly.
  • Jacob Vlijm
    Jacob Vlijm about 8 years
    @user2308211 I checked with a launcher pretty much the same as yours, in Unity it works fine here. Will try to find out...
  • SPMP
    SPMP about 8 years
    I'm not using the unity switcher though. I think that might be the reason. I'm using compiz application switcher. I prefer each window to be an entry in the switcher.
  • Elder Geek
    Elder Geek about 7 years
    This is good information for those who have a blank icon and a .desktop file with quotes in the line as in your example as I can confirm quotes can blank the icon, however if you check the OP's post, you'll note that this is not the case for them. This information would have been more accessible and useful as a self answered Q&A.
  • charles.cc.hsu
    charles.cc.hsu over 6 years
    Ubuntu 16.04, Eclipse oxygen How to set an icon for Eclipse? works for me
  • Pupil
    Pupil over 5 years
    This worked for me. Thanks for solving my problem.