# Ubuntu – Eclipse has two icons on unity launcher when I only want one

eclipseunity

I recently upgraded to Eclipse Luna and since then I've had trouble launching it from the Unity Launcher. I've modified my old .desktop file located in ~/.local/share/applications, then added it to my launcher and now it looks like this:

How can I fix this?

For reference, here's my eclipse.desktop file:

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Path=/home/jinkim/eclipse
Icon=/home/jinkim/eclipse/icon.xpm
Exec=/home/jinkim/eclipse/eclipse
Name=Eclipse Luna
Comment=This is an IDE
Icon=eclipse


• It seems there a line in the .desktop file that I was missing. In particular, the crucial line seems to be:

StartupWMClass=Eclipse


More info on that here: What represent the StartupWMClass field of a .desktop file?

So, I have found what works for me below:

#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Eclipse
GenericName=Eclipse Java IDE
Comment=Eclipse Java IDE
Categories=Utility;Developer Tools;IDEs;Java;
StartupWMClass=Eclipse
StartupNotify=true
Terminal=false
Type=Application
X-GNOME-FullName=Eclipse Java IDE


The steps I took to get this working are:

1. Use a text editor to create eclipse.desktop, and paste the above into it

2. Move eclipse.desktop into ~/.local/share/applications

3. Allow it to be executable: chmod +x eclipse.desktop

4. Double-click eclipse.desktop which should appear in Nautilus as Eclipse

5. In Unity launcher, right-click and select "Lock to Launcher"