Ubuntu: How to add Eclipse to the Unity Launcher

:

A quick how to: Add Eclipse to the Unity Launcher. You can add any other application to the Unity Launcher using these steps.

All the Unity Launchers (e.g. evince, gedit, etc) are implemented as .desktop files. These files are stored in the folder /usr/share/applications/. The .desktop file contains the following information: where the icon is located, where the executable is located, the launcher name, and other secondary information like a comment about the launcher.


Make Eclipse accessible from the command line

All the commands accessible from the command line are stored in a "bin" folder. The folder destined to user binaries is located in /usr/bin.

Let's add the eclipse executable to /usr/bin using the following command.

sudo ln -s /path/to/eclipse/eclipse /usr/bin/

Now eclipse is accessible from the command line as the command eclipse.


Put the icon in the right place

All the icons associated to a Unity Launcher are stored in the /usr/share/pixmap folder. Let's place the eclipse icon in the right folder.

sudo cp /path/to/eclipse/icon.xpm /usr/share/pixmap/eclipse.xpm


Create the .desktop file

Finally, you'll need to create a new .desktop file for Eclipse. Proceed with the following command.

sudo gedit /usr/share/applications/eclipse.desktop

Insert the following text inside this new file.

Note 1: If you didn't add eclipse to /usr/bin, you'll have to use the full path in the Exec section, e.g. Exec=/path/to/eclipse/eclipse

Note 2: If you didn't place the eclipse icon under the /usr/share/pixmap folder, you'll have to use the full path in the Icon section, e.g. Icon=/path/to/eclipse/icon.xpm

This is the result.

Now, Eclipse is accessible from dash and the Unity Launcher.