How to pin Eclipse to the Unity launcher?

How can I pin eclipse indigo 3.7 I have 'installed' at /opt/ to the taskbar?

I have tried launching eclipse and right-clicking to choose the 'keep in launcher' option. But when I click that icon, after closing eclipse, it doesn't start eclipse.

I have already looked at How do I add Eclipse Indigo to the launcher? but no answer worked for me. (Mod note: The answers from this thread are now merged into this one)


Solution 1:

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.

Solution 2:

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