Creating A Desktop Launcher For Eclipse

How to create a simple .desktop launcher for Eclipse in Ubuntu Gnome, and add it to your favorites.

17643 views
d

By. Jacob

Edited: 2020-03-26 23:18

It is that time again. I had to reinstall Ubuntu, including Eclipse. And, as usual, I ran into a bunch of problems. Some of them are just the usual Linux BS, such as Eclipse not being installed properly, so you manually have to create a launcher. And, as we all know, even simple things like installing software can be severely complicated when the packages are not available in the repositories.

In the worst of cases, it will require expert knowledge to fix. Mostly, just a lot of wasted time Googling our way to solutions.

It is not that I think it is hard to create launchers personally. I just think it is unnecessary, retarded, and truly pathetic that Linux still struggle in this area. Ubuntu does not even have one of the GUI tools installed by default, but not even the GUI tools are very good. So, I actually prefer creating the Launchers manually. Linux developers have a lot to learn from Windows in this area.

Creating a launcher for Eclipse

In this example, I am creating the launcher for Eclipse Oxygen, the latest version. But it should work for any version.

1. Start by opening a Terminal, then type the below command to create a .desktop file:

nano ~/.local/share/applications/eclipse.desktop

This will prompt you for your password to edit the file (you are actually creating it, if it does not exist).

2. Write the content to the file. The content of the file will be similar to the below, just remember to adjust the paths so they match your setup:

[Desktop Entry]
Type=Application
Name=Eclipse
Comment=Eclipse Integrated Development Environment
Icon=/home/k/eclipse/php-oxygen/eclipse/icon.xpm
Exec=/home/k/eclipse/php-oxygen/eclipse/eclipse
Terminal=false
Categories=Development
StartupWMClass=Eclipse

Pres CTRL + O to write the changes, then press CTRL + X to exit.

3. Make the file executable:

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

Note. While .desktop files do not contain "executable code" themselves in a traditional sense, they do still contain metadata that is read by the desktop environment, and some environments therefor require that the file is executable before allowing it to launch an application. You can skip this third step if this does not apply to your system

Done. You can now find the launcher when searching for Eclipse. Optionally, you can right-click on it, and add it to your favorites.

Video

Tell us what you think:

Russel

Thank you for posting this! Re-installing Linux is always a pain - so many trivial tasks need to be redone.

Trev

Thanks. Mine would not launch even though the path was correct and it was executable. After I added the line StartupWMClass=Eclipse it worked like gem.
Using Fedora 33 with Gnome 3.38.4

  1. How to fix a problem with PHP files and an empty outline in Eclipse.
  2. How to fix a frustrating problem with Fonts in Ubuntu Gnome and Eclipse. Possibly also affecting other Linux distributions.

More in: Eclipse