How to pin Eclipse to the Unity launcher?

For 11.10 and newer

First, create a .desktop file to eclipse:

gedit ~/.local/share/applications/opt_eclipse.desktop

Then, paste this inside (dont forget to edit Exec and Icon values):

[Desktop Entry]
Type=Application
Name=Eclipse
Comment=Eclipse Integrated Development Environment
Icon=** something like /opt/eclipse/icon.xpm **
Exec= ** something like /opt/eclipse/eclipse **
Terminal=false
Categories=Development;IDE;Java;
StartupWMClass=Eclipse

After that, open that folder with nautilus:

nautilus ~/.local/share/applications

If you want to use this launcher outside dash/launcher (ex: as a desktop launcher) you need to add execution permission by right clicking the file and choosing Properties -> Permissions -> Allow execution, or, via the command-line:

chmod +x ~/.local/share/applications/opt_eclipse.desktop

Finally drop opt_eclipse.desktop to launcher.


For Ubuntu 11.10, 12.04, 12.10

If the applications folder does not exist inside ~/.local/share/ create it

mkdir ~/.local/share/applications

Check if your installation left you with a workable .desktop file for Eclipse and copy it if exists

cp /usr/share/applications/eclipse.desktop ~/.local/share/applications/

If the file does not exist create a .desktop file for Eclipse in your ~/.local/share/applications/ folder using gnome-desktop-item-edit, ie:

gnome-desktop-item-edit --create-new ~/.local/share/applications/

On the name set it to Eclipse, on the command enter the path to the binary file of Eclipse, insert a comment if you want and click the icon to select the icon that you desire for Eclipse.

Press ok when you are finished.


After copying the file or creating your own open that folder location

nautilus ~/.local/share/applications/

Locate the file you just created and drag it to the launcher

enter image description here


11.04

If user21580's answer doesn't work (great suggestion, but I think it didn't work for me when I installed Indigo), you can try adding an eclipse.desktop file to ~/.local/share/applications/, with these contents:

#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
StartupNotify=true
Icon=<path-to-eclipse-install>/icon.xpm
Name=Eclipse Indigo 3.7
#Exec=env UBUNTU_MENUPROXY=0 <path-to-eclipse-install>/eclipse
Exec=env <path-to-eclipse-install>/eclipse

If you experience bugs, you can try the Exec line which is commented out instead of the current one.

References: