# Ubuntu – Icon assigned in .desktop file is not used when application is loaded and launcher icon appears

eclipseiconslauncherunityunity-dash

I am installing the newer application eclipse Juno on ubuntu 12.04 64bit, following this tutorial: http://www.blogs.digitalworlds.net/softwarenotes/?p=54.
I have already installed Eclipse Indigo in the past (the already version, found in Ubuntu repos).
Note that I may be using the Eclipse as an example here, but I have came across this behaviour in other cases too.

So, the original Eclipse Indigo .desktop file is the following:

[Desktop Entry]
Type=Application
Name=Eclipse
Comment=Eclipse Integrated Development Environment
Icon=eclipse
Exec=eclipse
Terminal=false
Categories=Development;IDE;Java;


I changed it though a bit for the sake of installing the new Eclipse Juno side by side with the old one. To the above file became:

[Desktop Entry]
Type=Application
Name="Eclipse Indigo"  #<------THIS CHANGED
Comment=Eclipse Integrated Development Environment
Icon=eclipse
Exec=eclipse
Terminal=false
Categories=Development;IDE;Java;


Finally I generate the .desktop file for eclipse juno, NOT in the way instructed by the guide but with the command

gnome-desktop-item-edit --create-new ~/applications


The contents of the file are:

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_US]=/opt/eclipse/icon.xpm
Name[en_US]=Eclipse Juno
Exec=/opt/eclipse/eclipse
Comment[en_US]=Eclipse Juno 4.2.2 IDE
Name=Eclipse Juno
Comment=Eclipse Juno 4.2.2 IDE
Icon=/opt/eclipse/icon.xpm


Now starting the application uses the newer Juno icon and hovering the icon says (surely enough) "Eclipse Juno".

So far, so good. However, if I start the application from the CLI , with /opt/eclipse/eclipse, I get the icon of Eclipse Indigo showing up on the launcher and hovering this icon says "Eclipse Indigo". However, it is Juno that has been started (which is what I wanted).

In the following picture, the top icon (in the red rectangle) is the Eclipse Juno. In the bottom icon is again Eclipse Juno, but started from the command line. Thank you for your help.

EDIT:
ok, ~/applications is taking more fame than it should. This is just a personal folder to keep applications, binaries and other personal stuff. I created the files in my personal folder and then copied the generated .desktop files in /usr/share/applications.

• Why did you create your desktop file in ~/applications directory? This desktop file should be placed into /usr/share/applications or into ~/.local/share/applications.

The right and successful way to do this is to use Main Menu (it can be installed with sudo apt-get install alacarte command). Search for it in Dash or you can open it from Terminal with this command:

alacarte


After it opens, follow the instructions in the image below:

You can check after in ~/.local/share/applications if you have a new desktop file for Eclipse Juno. The name of the new fesktop file should be something like alacarte-made-x.desktop (where x is a number). And now if you want a copy of this file in your ~/applications directory, you can copy it there without no problem.

And another one important thing: use the full path to the application for command (Exec=/path/to/eclipse) in both desktop files.